home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1993 July / InfoMagic USENET CD-ROM July 1993.ISO / sources / unix / volume25 / trash / part02 < prev    next >
Encoding:
Text File  |  1992-03-23  |  62.8 KB  |  3,676 lines

  1. Newsgroups: comp.sources.unix
  2. From: bruce@beta.cs.su.oz.au (Bruce Janson)
  3. Subject: v25i156: trash - simulate process execution in MIPS RISC/os 4.52, Part02/08
  4. Sender: unix-sources-moderator@pa.dec.com
  5. Approved: vixie@pa.dec.com
  6.  
  7. Submitted-By: bruce@beta.cs.su.oz.au (Bruce Janson)
  8. Posting-Number: Volume 25, Issue 156
  9. Archive-Name: trash/part02
  10.  
  11. #! /bin/sh
  12. # This is a shell archive.  Remove anything before this line, then unpack
  13. # it by saving it into a file and typing "sh file".  To overwrite existing
  14. # files, type "sh file -c".  You can also feed this as standard input via
  15. # unshar, or by typing "sh <file", e.g..  If this archive is complete, you
  16. # will see the following message at the end:
  17. #        "End of archive 2 (of 8)."
  18. # Contents:  fd.c format.c go.c i_a.c i_b.c i_l.c load.c makefile
  19. #   trash.1
  20. # Wrapped by bruce@basser on Tue Mar  3 23:25:21 1992
  21. PATH=/bin:/usr/bin:/usr/ucb ; export PATH
  22. if test -f 'fd.c' -a "${1}" != "-c" ; then 
  23.   echo shar: Will not clobber existing file \"'fd.c'\"
  24. else
  25. echo shar: Extracting \"'fd.c'\" \(5477 characters\)
  26. sed "s/^X//" >'fd.c' <<'END_OF_FILE'
  27. X#include    <fcntl.h>
  28. X#include    <errno.h>
  29. X#include    <stdio.h>
  30. X#include    "nels.h"
  31. X
  32. X/*
  33. X * A unix process has a limited, usually small number of
  34. X * file descriptors available to it.
  35. X * A simulator for such a process which also uses file
  36. X * descriptors itself, must stop the simulated process
  37. X * from interfering with the simulator's file descriptors
  38. X * but otherwise maintain as normal a set of file descriptors
  39. X * for use by the process as possible.
  40. X * The routines in this file attempt to accomplish this.
  41. X */
  42. X
  43. X#define    FD_CLOSED        ((fd_t)-1)
  44. X#define    NFDOHEAD        2
  45. X
  46. X#define    fd_valid_fd(fd)        ((fd) >= 0 && (fd) < nfiles)
  47. X
  48. Xtypedef int            fd_t;
  49. X
  50. Xextern int            setobuf();
  51. X
  52. Xextern int            errno;
  53. Xextern FILE            *outfp;
  54. X
  55. Xstatic int            nfiles        = -1;
  56. Xstatic fd_t            *map;    /* map: simfd -> realfd    */
  57. Xstatic int            fdoverhead[NFDOHEAD];
  58. X
  59. Xint
  60. Xfd_hold()
  61. X{
  62. X    int    i;
  63. X
  64. X    for (i = 0; i < nels(fdoverhead); i++)
  65. X    {
  66. X        if ((fdoverhead[i] = open("/dev/null", O_RDONLY)) == -1)
  67. X        {
  68. X            vcouldnot("open(\"/dev/null\", O_RDONLY)");
  69. X            return -1;
  70. X        }
  71. X
  72. X        if (fcntl(fdoverhead[i], F_SETFD, 1) == -1)
  73. X        {
  74. X            vcouldnot("fcntl(%d, F_SETFD, 1)", fdoverhead[i]);
  75. X            (void)close(fdoverhead[i]);
  76. X            return -1;
  77. X        }
  78. X    }
  79. X
  80. X    return 0;
  81. X}
  82. X
  83. Xint
  84. Xfd_release()
  85. X{
  86. X    int    i;
  87. X
  88. X    for (i = 0; i < nels(fdoverhead); i++)
  89. X    {
  90. X        if (fdoverhead[i] != -1)
  91. X        {
  92. X            (void)close(fdoverhead[i]);
  93. X            fdoverhead[i] = -1;
  94. X        }
  95. X    }
  96. X
  97. X    return 0;
  98. X}
  99. X
  100. X#if    0
  101. Xstatic
  102. Xvoid
  103. Xfd_dump()
  104. X{
  105. X    int    fd;
  106. X
  107. X    fprintf(outfp, "map (%d):", fileno(outfp));
  108. X    for (fd = 0; fd < nfiles; fd++)
  109. X    {
  110. X        if (map[fd] == FD_CLOSED)
  111. X            continue;
  112. X
  113. X        if (map[fd] == fd)
  114. X            continue;
  115. X
  116. X        fprintf(outfp, " %d->%d", fd, map[fd]);
  117. X    }
  118. X    fprintf(outfp, "\n");
  119. X    fflush(outfp);
  120. X}
  121. X#endif    /* 0 */
  122. X
  123. X/*
  124. X * Initialise our file descriptor map.
  125. X * We record all file descriptors that
  126. X * we have inherited at birth.
  127. X * fd_init() must be called before the
  128. X * simulator starts opening any files for its own
  129. X * internal use.
  130. X * 'outfd' != -1 iff the output file descriptor
  131. X * has been explicitly passed to us via a
  132. X * command line argument.
  133. X */
  134. Xint
  135. Xfd_init(outfd)
  136. Xint    outfd;
  137. X{
  138. X    int    fd;
  139. X
  140. X    if ((nfiles = ulimit(4, 0)) == -1)
  141. X    {
  142. X        couldnot("get descriptor table size");
  143. X        return -1;
  144. X    }
  145. X
  146. X    if ((map = (fd_t *)malloc(sizeof(fd_t) * nfiles)) == (fd_t *)0)
  147. X    {
  148. X        couldnot("allocate %d bytes for descriptor table map", sizeof(fd_t) * nfiles);
  149. X        return -1;
  150. X    }
  151. X
  152. X    for (fd = 0; fd < nfiles; fd++)
  153. X    {
  154. X        if (fcntl(fd, F_GETFD, 0) == -1)
  155. X        {
  156. X            if (errno != EBADF)
  157. X            {
  158. X                couldnot("interpret error returned by fcntl(%d, F_GETFD, ..)", fd);
  159. X                return -1;
  160. X            }
  161. X            errno = 0;
  162. X
  163. X            map[fd] = FD_CLOSED;
  164. X        }
  165. X        else
  166. X            map[fd] = fd;
  167. X    }
  168. X
  169. X    if (outfd != -1)
  170. X        map[outfd] = FD_CLOSED;
  171. X
  172. X    if (fd_hold() == -1)
  173. X        return -1;
  174. X
  175. X    return 0;
  176. X}
  177. X
  178. Xint
  179. Xfd_sort()
  180. X{
  181. X    int    sim_outfd;
  182. X    int    real_outfd;
  183. X    int    fd;
  184. X    fd_t    *rmap;
  185. X
  186. X#if    0
  187. X    fd_dump();
  188. X#endif    /* 0 */
  189. X
  190. X    if (fd_release() == -1)
  191. X        return -1;
  192. X
  193. X    if ((rmap = (fd_t *)malloc(sizeof(fd_t) * nfiles)) == (fd_t *)0)
  194. X    {
  195. X        vcouldnot("allocate %d bytes for reverse descriptor table map", sizeof(fd_t) * nfiles);
  196. X        return -1;
  197. X    }
  198. X
  199. X    fflush(outfp);
  200. X    if ((sim_outfd = fd_open(fileno(outfp))) == -1)
  201. X        return -1;
  202. X
  203. X    for (fd = 0; fd < nfiles; fd++)
  204. X        rmap[fd] = FD_CLOSED;
  205. X
  206. X    for (fd = 0; fd < nfiles; fd++)
  207. X    {
  208. X        if (map[fd] != FD_CLOSED)
  209. X            rmap[map[fd]] = fd;
  210. X    }
  211. X
  212. X    for (fd = 0; fd < nfiles; fd++)
  213. X    {
  214. X        if (rmap[fd] == fd)
  215. X            continue;
  216. X
  217. X        if (rmap[fd] != FD_CLOSED)
  218. X        {
  219. X            int    newfd;
  220. X
  221. X            if ((newfd = dup(fd)) == -1)
  222. X            {
  223. X                vcouldnot("dup(%d)", fd);
  224. X                return -1;
  225. X            }
  226. X            rmap[newfd] = rmap[fd];
  227. X            map[rmap[fd]] = newfd;
  228. X            if (close(fd) == -1)
  229. X            {
  230. X                vcouldnot("close(%d)", fd);
  231. X                return -1;
  232. X            }
  233. X            rmap[fd] = FD_CLOSED;
  234. X        }
  235. X
  236. X        if (map[fd] == FD_CLOSED)
  237. X            continue;
  238. X
  239. X        if (dup2(map[fd], fd) == -1)
  240. X        {
  241. X            vcouldnot("dup2(%d, %d)", map[fd], fd);
  242. X            return -1;
  243. X        }
  244. X
  245. X        rmap[fd] = fd;
  246. X        if (close(map[fd]) == -1)
  247. X        {
  248. X            vcouldnot("close(%d)", map[fd]);
  249. X            return -1;
  250. X        }
  251. X        rmap[map[fd]] = FD_CLOSED;
  252. X        map[fd] = fd;
  253. X    }
  254. X
  255. X    real_outfd = map[sim_outfd];
  256. X
  257. X    if (real_outfd != fileno(outfp))
  258. X    {
  259. X        FILE    *newoutfp;
  260. X
  261. X        if ((newoutfp = fdopen(real_outfd, "a")) == (FILE *)0)
  262. X        {
  263. X            vcouldnot("fdopen(%d, \"a\")", real_outfd);
  264. X            return -1;
  265. X        }
  266. X        (void)fclose(outfp);
  267. X        outfp = newoutfp;
  268. X
  269. X        if (setobuf() == -1)
  270. X            return -1;
  271. X    }
  272. X
  273. X    (void)fd_close(sim_outfd);
  274. X
  275. X    (void)free((char *)rmap);
  276. X
  277. X    if (fd_hold() == -1)
  278. X        return -1;
  279. X
  280. X#if    0
  281. X    fd_dump();
  282. X#endif    /* 0 */
  283. X
  284. X    return 0;
  285. X}
  286. X
  287. X/*
  288. X * Given a good, real file descriptor,
  289. X * return a simulated file descriptor and
  290. X * mark it as allocated.
  291. X */
  292. Xint
  293. Xfd_open(real_fd)
  294. Xint    real_fd;
  295. X{
  296. X    int    sim_fd;
  297. X
  298. X    for (sim_fd = 0; sim_fd < nfiles; sim_fd++)
  299. X    {
  300. X        if (map[sim_fd] == FD_CLOSED)
  301. X        {
  302. X            map[sim_fd] = real_fd;
  303. X            return sim_fd;
  304. X        }
  305. X    }
  306. X
  307. X    vcouldnot("open real file descriptor %d: internal error: ran out of simulated file descriptors", real_fd);
  308. X    return -1;
  309. X}
  310. X
  311. X/*
  312. X * Given a good, real file descriptor,
  313. X * and an unallocated simulated file descriptor,
  314. X * mark it as allocated.
  315. X */
  316. Xvoid
  317. Xfd_dopen(real_fd, sim_fd)
  318. Xint    real_fd;
  319. Xint    sim_fd;
  320. X{
  321. X    map[sim_fd] = real_fd;
  322. X}
  323. X
  324. X/*
  325. X * Unmap a simulated file descriptor.
  326. X */
  327. Xint
  328. Xfd_close(sim_fd)
  329. Xint    sim_fd;
  330. X{
  331. X    if (fd_valid_fd(sim_fd))
  332. X        map[sim_fd] = FD_CLOSED;
  333. X
  334. X    return 0;
  335. X}
  336. X
  337. X/*
  338. X * Return the current mapping for a simulated
  339. X * file descriptor, or -1 if it is not mapped.
  340. X */
  341. Xint
  342. Xfd_lookup(sim_fd)
  343. Xint    sim_fd;
  344. X{
  345. X    if (fd_valid_fd(sim_fd) == 0)
  346. X        return -1;
  347. X
  348. X    if (map[sim_fd] == FD_CLOSED)
  349. X        return -1;
  350. X
  351. X    return map[sim_fd];
  352. X}
  353. X
  354. Xint
  355. Xfd_invalid(sim_fd)
  356. Xint    sim_fd;
  357. X{
  358. X    if (fd_valid_fd(sim_fd))
  359. X        return 0;
  360. X
  361. X    errno = EBADF;
  362. X
  363. X    return 1;
  364. X}
  365. X
  366. Xint
  367. Xfd_nfiles()
  368. X{
  369. X    return nfiles;
  370. X}
  371. END_OF_FILE
  372. if test 5477 -ne `wc -c <'fd.c'`; then
  373.     echo shar: \"'fd.c'\" unpacked with wrong size!
  374. fi
  375. # end of 'fd.c'
  376. fi
  377. if test -f 'format.c' -a "${1}" != "-c" ; then 
  378.   echo shar: Will not clobber existing file \"'format.c'\"
  379. else
  380. echo shar: Extracting \"'format.c'\" \(5070 characters\)
  381. sed "s/^X//" >'format.c' <<'END_OF_FILE'
  382. X#include    <varargs.h>
  383. X
  384. X/*
  385. X * format converts and formats its args under control of the format.
  386. X * The format is a character string that contains two types of
  387. X * objects:  plain characters, which are simply passed one at a time
  388. X * to putfn, and conversion specifications, each of which results in
  389. X * fetching of zero or more args.  The results are undefined if
  390. X * there are insufficient args for the format.  If the format
  391. X * is exhausted while args remain, the excess args are simply
  392. X * ignored.
  393. X * 
  394. X * Each conversion specification is introduced by the character
  395. X * %.  After the %, any of the following may appear in sequence:
  396. X * 
  397. X * A set of flags, which modify the meaning of the
  398. X * conversion specification.
  399. X * 
  400. X * A zero digit (0) specifying the pad character as 0.
  401. X * 
  402. X * A decimal digit string specifying a minimum field width.
  403. X * 
  404. X * A period (.) followed by a decimal digit string specifying a precision.
  405. X * 
  406. X * An l (ell) specifying that a following conversion character
  407. X * applies to a long arg.
  408. X * 
  409. X * A character that indicates the type of conversion to be
  410. X * applied.
  411. X */
  412. X
  413. X#define    doit(c, v)    sprintf(&a[0], mkfmt((c)), (v)), outstring(&a[0])
  414. X
  415. Xstatic int    (*putfn)();
  416. Xstatic int    flag_minus;
  417. Xstatic int    flag_plus;
  418. Xstatic int    flag_blank;
  419. Xstatic int    flag_hash;
  420. Xstatic char    pad_character;
  421. Xstatic int    have_width;
  422. Xstatic int    minimum_field_width;
  423. Xstatic int    have_precision;
  424. Xstatic int    precision;
  425. Xstatic int    use_short_form;
  426. Xstatic int    use_long_form;
  427. Xstatic char    a[256];
  428. X
  429. Xstatic
  430. Xchar    *
  431. Xmkfmt(c)
  432. Xchar    c;
  433. X{
  434. X    extern int    strlen();
  435. X    static char    a[32];
  436. X
  437. X    (void)sprintf
  438. X    (
  439. X        &a[0],
  440. X        "%%%s%s%s%s%s",
  441. X        flag_minus ? "-" : "",
  442. X        flag_plus ? "+" : "",
  443. X        flag_blank ? " " : "",
  444. X        flag_hash ? "#" : "",
  445. X        (pad_character == '0') ? "0" : ""
  446. X    );
  447. X
  448. X    if (have_width)
  449. X        (void)sprintf(&a[strlen(&a[0])], "%d", minimum_field_width);
  450. X
  451. X    if (have_precision)
  452. X        (void)sprintf(&a[strlen(&a[0])], ".%d", precision);
  453. X
  454. X    (void)sprintf
  455. X    (
  456. X        &a[strlen(&a[0])],
  457. X        "%s%s%c",
  458. X        use_short_form ? "h" : "",
  459. X        use_long_form ? "l" : "",
  460. X        c
  461. X    );
  462. X
  463. X    return &a[0];
  464. X}
  465. X
  466. Xstatic
  467. Xvoid
  468. Xoutstring(s)
  469. Xregister char    *s;
  470. X{
  471. X    while (*s != '\0')
  472. X        (*putfn)(*s++);
  473. X}
  474. X
  475. Xvoid
  476. Xformat(uputfn, app)
  477. Xregister int        (*uputfn)();
  478. Xregister va_list    *app;
  479. X{
  480. X    register char    *formatp;    /* Pointer to current    */
  481. X                    /* format character.    */
  482. X    register char    fc;        /* Current format    */
  483. X                    /* character.        */
  484. X
  485. X    formatp = va_arg(*app, char *);
  486. X
  487. X    putfn = uputfn;
  488. X
  489. X    while ((fc = *formatp++) != '\0')
  490. X    {
  491. X        if (fc != '%')
  492. X        {
  493. X            (*uputfn)(fc);
  494. X            continue;
  495. X        }
  496. X
  497. X        flag_minus = 0;
  498. X        flag_plus = 0;
  499. X        flag_blank = 0;
  500. X        flag_hash = 0;
  501. X        pad_character = ' ';
  502. X        have_width = 0;
  503. X        minimum_field_width = 0;
  504. X        have_precision = 0;
  505. X        precision = 1;
  506. X        use_short_form = 0;
  507. X        use_long_form = 0;
  508. X
  509. X        /*
  510. X         * Read some optional flags.
  511. X         */
  512. X        for (;;)
  513. X        {
  514. X            switch (fc = *formatp++)
  515. X            {
  516. X            case '-':
  517. X                flag_minus = 1;
  518. X                continue;
  519. X
  520. X            case '+':
  521. X                flag_plus = 1;
  522. X                flag_blank = 0;
  523. X                continue;
  524. X
  525. X            case ' ':
  526. X                if (flag_plus == 0)
  527. X                    flag_blank = 1;
  528. X                continue;
  529. X
  530. X            case '#':
  531. X                flag_hash = 1;
  532. X                continue;
  533. X
  534. X            default:
  535. X                break;
  536. X            }
  537. X            break;
  538. X        }
  539. X
  540. X        /*
  541. X         * Read an optional '0' pad character specification.
  542. X         */
  543. X        if (fc == '0')
  544. X        {
  545. X            pad_character = '0';
  546. X            fc = *formatp++;
  547. X        }
  548. X
  549. X        /*
  550. X         * Read an optional minimum field width.
  551. X         */
  552. X        for (;;)
  553. X        {
  554. X            if (fc == '*')
  555. X                minimum_field_width = va_arg(*app, int);
  556. X            else if (fc >= '0' && fc <= '9')
  557. X            {
  558. X                minimum_field_width *= 10;
  559. X                minimum_field_width += fc - '0';
  560. X            }
  561. X            else
  562. X                break;
  563. X
  564. X            have_width = 1;
  565. X
  566. X            fc = *formatp++;
  567. X        }
  568. X
  569. X        /*
  570. X         * Read an optional precision specifier.
  571. X         */
  572. X        if (fc == '.')
  573. X        {
  574. X            fc = *formatp++;
  575. X
  576. X            have_precision = 1;
  577. X
  578. X            precision = 0;
  579. X
  580. X            for (;;)
  581. X            {
  582. X                if (fc == '*')
  583. X                    precision = va_arg(*app, int);
  584. X                else if (fc >= '0' && fc <= '9')
  585. X                {
  586. X                    precision *= 10;
  587. X                    precision += fc - '0';
  588. X                }
  589. X                else
  590. X                    break;
  591. X
  592. X                fc = *formatp++;
  593. X            }
  594. X        }
  595. X
  596. X        if (precision < 0)
  597. X            precision = 0;
  598. X
  599. X        /*
  600. X         * Read an optional 'short field' specifier.
  601. X         */
  602. X        if (fc == 'h')
  603. X        {
  604. X            use_short_form = 1;
  605. X            fc = *formatp++;
  606. X        }
  607. X
  608. X        /*
  609. X         * Read an optional 'long field' specifier.
  610. X         */
  611. X        if (fc == 'l')
  612. X        {
  613. X            use_long_form = 1;
  614. X            fc = *formatp++;
  615. X        }
  616. X
  617. X        /*
  618. X         * Read the conversion character.
  619. X         * Do the formatting.
  620. X         */
  621. X        switch (fc)
  622. X        {
  623. X        case 'c':
  624. X            doit(fc, (char)va_arg(*app, int));
  625. X            break;
  626. X
  627. X        case 'd':
  628. X        case 'i':
  629. X            if (use_short_form)
  630. X                doit(fc, (short)va_arg(*app, int));
  631. X            else if (use_long_form)
  632. X                doit(fc, va_arg(*app, long));
  633. X            else
  634. X                doit(fc, va_arg(*app, int));
  635. X            break;
  636. X
  637. X        case 'E':
  638. X        case 'e':
  639. X        case 'f':
  640. X        case 'G':
  641. X        case 'g':
  642. X            doit(fc, va_arg(*app, double));
  643. X            break;
  644. X
  645. X        case 's':
  646. X            doit(fc, va_arg(*app, char *));
  647. X            break;
  648. X
  649. X        case 'o':
  650. X        case 'u':
  651. X        case 'X':
  652. X        case 'x':
  653. X            if (use_short_form)
  654. X                doit(fc, (unsigned short)va_arg(*app, unsigned int));
  655. X            else if (use_long_form)
  656. X                doit(fc, va_arg(*app, unsigned long));
  657. X            else
  658. X                doit(fc, va_arg(*app, unsigned int));
  659. X            break;
  660. X
  661. X        case '\0':
  662. X            formatp--;
  663. X            fc = '%';
  664. X            /* and fall thru. */
  665. X        case '%':
  666. X        default:
  667. X            (*uputfn)(fc);
  668. X            break;
  669. X        }
  670. X    }
  671. X}
  672. END_OF_FILE
  673. if test 5070 -ne `wc -c <'format.c'`; then
  674.     echo shar: \"'format.c'\" unpacked with wrong size!
  675. fi
  676. # end of 'format.c'
  677. fi
  678. if test -f 'go.c' -a "${1}" != "-c" ; then 
  679.   echo shar: Will not clobber existing file \"'go.c'\"
  680. else
  681. echo shar: Extracting \"'go.c'\" \(8593 characters\)
  682. sed "s/^X//" >'go.c' <<'END_OF_FILE'
  683. X#include    <stdio.h>
  684. X#include    "register.h"
  685. X#include    "symtab.h"
  686. X#include    "diblock.h"
  687. X#include    "instrn.h"
  688. X#include    "process.h"
  689. X#include    "nels.h"
  690. X
  691. X#define    TWOTIMES(s)    s;s
  692. X#define    FOURTIMES(s)    TWOTIMES(s);TWOTIMES(s)
  693. X#define    EIGHTTIMES(s)    FOURTIMES(s);FOURTIMES(s)
  694. X#define    SIXTEENTIMES(s)    EIGHTTIMES(s);EIGHTTIMES(s)
  695. X
  696. Xextern void        histo_log();
  697. Xextern void        hist_log();
  698. Xextern instrn        *getip();
  699. Xextern char        *say_pg_register();
  700. X
  701. Xextern FILE        *outfp;
  702. Xextern int        Bflag;
  703. Xextern int        Hflag;
  704. Xextern int        Iflag;
  705. Xextern int        Nflag;
  706. Xextern unsigned long    instruction_count;
  707. Xextern unsigned long    instruction_count_since_last_syscall;
  708. Xextern int        hist_length;
  709. X
  710. Xstatic instrn        *ip;
  711. Xstatic unsigned long    i;
  712. X
  713. Xint            compile_ok;
  714. X
  715. Xvoid
  716. Xunrecognised(dipc)
  717. Xdinstrn    *dipc;
  718. X{
  719. X    GLOBALdipc = dipc;
  720. X    vcouldnot("execute unrecognised instruction: <0x%x> \"%s\" [p.%s]", i, ip->i_name, ip->i_pageno);
  721. X}
  722. X
  723. X/*
  724. X * Execute the next instruction.
  725. X */
  726. Xstatic
  727. Xdinstrn    *
  728. Xi_execute(dipc)
  729. Xdinstrn    *dipc;
  730. X{
  731. X    unsigned long    opcodesPC;
  732. X    unsigned int    rs;
  733. X    unsigned int    rt;
  734. X    unsigned int    immediate;
  735. X    unsigned long    target;
  736. X    unsigned int    rd;
  737. X    unsigned int    shamt;
  738. X    unsigned int    funct;
  739. X    unsigned int    fmt;
  740. X    unsigned int    ft;
  741. X    unsigned int    fs;
  742. X    unsigned int    fd;
  743. X
  744. X    /*
  745. X     * Signals to be delivered?
  746. X     */
  747. X    if (sigs_pending > 0)
  748. X    {
  749. X        dipc = deliver_signal(dipc);
  750. X
  751. X        return dipc;
  752. X    }
  753. X
  754. X    /*
  755. X     * Get the current pc.
  756. X     */
  757. X    opcodesPC = dipc->di_addr;
  758. X
  759. X    /*
  760. X     * Check for an unaligned pc.
  761. X     */
  762. X    if ((opcodesPC % 4) != 0)
  763. X    {
  764. X        GLOBALdipc = dipc;
  765. X        vcouldnot("fetch instruction at unaligned address");
  766. X        return dipc;
  767. X    }
  768. X
  769. X    if (Hflag)
  770. X        histo_log(opcodesPC);
  771. X
  772. X    if (hist_length > 0)
  773. X        hist_log(opcodesPC);
  774. X
  775. X    /*
  776. X     * Put into 'i' the instruction word found
  777. X     * at address 'opcodesPC' in the address space of
  778. X     * process 'P' and make 'ip' point to
  779. X     * a description of that instruction.
  780. X     */
  781. X    if (procmget(dipc, opcodesPC, (unsigned char *)&i, sizeof(i)) == -1)
  782. X        return dipc;
  783. X
  784. X    if ((ip = getip(i)) == (instrn *)0)
  785. X        return dipc;
  786. X
  787. X    /*
  788. X     * Now,
  789. X     * 'i'  contains a copy of the current instruction,
  790. X     * 'ip' points to a description of the current instruction
  791. X     *    and
  792. X     * 'pc' contains the address of the first byte of the
  793. X     *      next instruction.
  794. X     */
  795. X
  796. X    if (Iflag)
  797. X        fprintf(outfp, "\t%s:\t%s\t", proc_text_address(opcodesPC), ip->i_name);
  798. X
  799. X    switch (ip->i_format)
  800. X    {
  801. X    case IF_I:
  802. X        /*
  803. X         * Immediate.
  804. X         */
  805. X        rs = i_to_rs(i);
  806. X        rt = i_to_rt(i);
  807. X        immediate = i_to_immediate(i);
  808. X        if (Iflag)
  809. X        {
  810. X            fprintf(outfp, "rs=%s,", say_pg_register(rs));
  811. X            fprintf(outfp, "rt=%s,", say_pg_register(rt));
  812. X            fprintf(outfp, "immediate=%d", immediate);
  813. X            if (Bflag)
  814. X                fprintf(outfp, "\t[p.%s]", ip->i_pageno);
  815. X            fprintf(outfp, "\n");
  816. X        }
  817. X        dipc = (*(ip->i_handler))(dipc, rs, rt, (short)immediate);
  818. X        break;
  819. X
  820. X    case IF_I1:
  821. X        /*
  822. X         * Immediate (cop1).
  823. X         */
  824. X        immediate = i_to_immediate(i);
  825. X        if (Iflag)
  826. X        {
  827. X            fprintf(outfp, "immediate=%d", immediate);
  828. X            if (Bflag)
  829. X                fprintf(outfp, "\t[p.%s]", ip->i_pageno);
  830. X            fprintf(outfp, "\n");
  831. X        }
  832. X        dipc = (*(ip->i_handler))(dipc, (short)immediate);
  833. X        break;
  834. X
  835. X    case IF_J:
  836. X        /*
  837. X         * Jump.
  838. X         */
  839. X        target = i_to_target(i);
  840. X        if (Iflag)
  841. X        {
  842. X            fprintf(outfp, "target=%s", proc_text_address((opcodesPC & 0xF0000000) | (target << 2)));
  843. X
  844. X            if (Bflag)
  845. X                fprintf(outfp, "\t[p.%s]", ip->i_pageno);
  846. X            fprintf(outfp, "\n");
  847. X        }
  848. X        dipc = (*(ip->i_handler))(dipc, target);
  849. X        break;
  850. X
  851. X    case IF_M1:
  852. X        /*
  853. X         * Move (cop1).
  854. X         */
  855. X        rt = i_to_rt(i);
  856. X        fs = i_to_fs(i);
  857. X        if (Iflag)
  858. X        {
  859. X            fprintf(outfp, "rt=%s,", say_pg_register(rt));
  860. X            fprintf(outfp, "fs=%s", say_fg_register(fs));
  861. X            if (Bflag)
  862. X                fprintf(outfp, "\t[p.%s]", ip->i_pageno);
  863. X            fprintf(outfp, "\n");
  864. X        }
  865. X        dipc = (*(ip->i_handler))(dipc, rt, fs);
  866. X        break;
  867. X
  868. X    case IF_C1:
  869. X        /*
  870. X         * Control (cop1).
  871. X         */
  872. X        rt = i_to_rt(i);
  873. X        fs = i_to_fs(i);
  874. X        if (Iflag)
  875. X        {
  876. X            fprintf(outfp, "rt=%s,", say_pg_register(rt));
  877. X            fprintf(outfp, "fs=%s", say_fc_register(fs));
  878. X            if (Bflag)
  879. X                fprintf(outfp, "\t[p.%s]", ip->i_pageno);
  880. X            fprintf(outfp, "\n");
  881. X        }
  882. X        dipc = (*(ip->i_handler))(dipc, rt, fs);
  883. X        break;
  884. X
  885. X    case IF_R:
  886. X        /*
  887. X         * Register.
  888. X         */
  889. X        rs = i_to_rs(i);
  890. X        rt = i_to_rt(i);
  891. X        rd = i_to_rd(i);
  892. X        shamt = i_to_shamt(i);
  893. X        funct = i_to_funct(i);
  894. X        if (Iflag)
  895. X        {
  896. X            fprintf(outfp, "rs=%s,", say_pg_register(rs));
  897. X            fprintf(outfp, "rt=%s,", say_pg_register(rt));
  898. X            fprintf(outfp, "rd=%s,", say_pg_register(rd));
  899. X            fprintf(outfp, "shamt=%d,funct=%d", shamt, funct);
  900. X            if (Bflag)
  901. X                fprintf(outfp, "\t[p.%s]", ip->i_pageno);
  902. X            fprintf(outfp, "\n");
  903. X        }
  904. X        dipc = (*(ip->i_handler))(dipc, rs, rt, rd, shamt, funct);
  905. X        break;
  906. X
  907. X    case IF_R1:
  908. X        /*
  909. X         * Register (cop1).
  910. X         */
  911. X        fmt = i_to_fmt(i);
  912. X        ft = i_to_ft(i);
  913. X        fs = i_to_fs(i);
  914. X        fd = i_to_fd(i);
  915. X        if (Iflag)
  916. X        {
  917. X            fprintf(outfp, "fmt=%d,", fmt);
  918. X            fprintf(outfp, "ft=%s,", say_fg_register(ft));
  919. X            fprintf(outfp, "fs=%s,", say_fg_register(fs));
  920. X            fprintf(outfp, "fd=%s", say_fg_register(fd));
  921. X            if (Bflag)
  922. X                fprintf(outfp, "\t[p.%s]", ip->i_pageno);
  923. X            fprintf(outfp, "\n");
  924. X        }
  925. X        dipc = (*(ip->i_handler))(dipc, fmt, ft, fs, fd);
  926. X        break;
  927. X
  928. X    case IF_U:
  929. X    default:
  930. X        /*
  931. X         * Undefined.
  932. X         */
  933. X        if (Iflag)
  934. X            fprintf(outfp, "\n");
  935. X        unrecognised(dipc);
  936. X        break;
  937. X    }
  938. X
  939. X    if (Nflag)
  940. X    {
  941. X        instruction_count++;
  942. X        instruction_count_since_last_syscall++;
  943. X    }
  944. X
  945. X    return dipc;
  946. X}
  947. X
  948. Xstatic
  949. Xdinstrn    *
  950. Xi_end_of_block(dipc)
  951. Xdinstrn    *dipc;
  952. X{
  953. X    dinstrn    *olddipc;
  954. X    int    saved_compile_ok;
  955. X
  956. X    olddipc = dipc;
  957. X
  958. X    saved_compile_ok = compile_ok;
  959. X    compile_ok = 0;
  960. X
  961. X    dipc = i_execute(dipc);
  962. X
  963. X    compile_ok = saved_compile_ok;
  964. X
  965. X    if (dipc == olddipc)
  966. X    {
  967. X        dipc = addr_to_decoded_instrnp(dipc, dipc->di_addr + sizeof(unsigned long));
  968. X
  969. X        dipc--;
  970. X    }
  971. X
  972. X    return dipc;
  973. X}
  974. X
  975. Xstatic unsigned long    lastpageno;
  976. Xstatic unsigned long    lastaddr;
  977. Xstatic dinstrn        *lastresult;
  978. X
  979. Xdinstrn    *
  980. Xaddr_to_decoded_instrnp(dipc, addr)
  981. Xdinstrn        *dipc;
  982. Xunsigned long    addr;
  983. X{
  984. X    unsigned long    pageno;
  985. X    diblock        *bp;
  986. X
  987. X    if ((pageno = addr / SIMULATED_PAGE_SIZE) == lastpageno)
  988. X        return lastresult + ((long)addr - (long)lastaddr) / sizeof(unsigned long);
  989. X
  990. X    lastpageno = pageno;
  991. X    lastaddr = addr;
  992. X
  993. X    if ((bp = addr_to_decoded_block(dipc, addr)) == (diblock *)0)
  994. X        return (dinstrn *)0;
  995. X
  996. X    if (bp->dib_want_init)
  997. X    {
  998. X        int        i;
  999. X        unsigned long    a;
  1000. X
  1001. X        bp->dib_want_init = 0;
  1002. X
  1003. X        for (i = 0, a = bp->dib_first_addr; i < nels(bp->dib_instrn) - 1; i++, a += sizeof(unsigned long))
  1004. X        {
  1005. X            bp->dib_instrn[i].di_handler = i_execute;
  1006. X            bp->dib_instrn[i].di_addr = a;
  1007. X        }
  1008. X
  1009. X        bp->dib_instrn[nels(bp->dib_instrn) - 1].di_handler = i_end_of_block;
  1010. X        bp->dib_instrn[nels(bp->dib_instrn) - 1].di_addr = a;
  1011. X    }
  1012. X
  1013. X    return lastresult = &bp->dib_instrn[(addr - bp->dib_first_addr) / sizeof(unsigned long)];
  1014. X}
  1015. X
  1016. Xint
  1017. Xclear_decoded_page(dipc, addr, remainderp)
  1018. Xdinstrn        *dipc;
  1019. Xunsigned long    addr;
  1020. Xint        *remainderp;
  1021. X{
  1022. X    unsigned long    pageno;
  1023. X    diblock        *bp;
  1024. X
  1025. X    if ((pageno = addr / SIMULATED_PAGE_SIZE) == lastpageno)
  1026. X        lastpageno = 0;
  1027. X
  1028. X    if ((bp = addr_to_decoded_block(dipc, addr)) == (diblock *)0)
  1029. X        return -1;
  1030. X
  1031. X    bp->dib_want_init = 1;
  1032. X
  1033. X    *remainderp = bp->dib_first_addr + SIMULATED_PAGE_SIZE - addr;
  1034. X
  1035. X    return 0;
  1036. X}
  1037. X
  1038. Xint
  1039. Xcompile_known_delayed_branch(dipc, target)
  1040. Xdinstrn        *dipc;
  1041. Xunsigned long    target;
  1042. X{
  1043. X    dinstrn    *dp;
  1044. X
  1045. X    if ((dp = addr_to_decoded_instrnp(dipc, dipc->di_addr + sizeof(unsigned long))) == (dinstrn *)0)
  1046. X        return -1;
  1047. X
  1048. X    dipc->di_2 = (unsigned long *)dp;
  1049. X
  1050. X    if ((dipc->di_3 = (unsigned long *)addr_to_decoded_instrnp(dipc, target)) == (unsigned long *)0)
  1051. X        return -1;
  1052. X
  1053. X    dipc->di_3 = (unsigned long *)(((dinstrn *)dipc->di_3) - 1);
  1054. X
  1055. X    return 0;
  1056. X}
  1057. X
  1058. Xint
  1059. Xcompile_unknown_delayed_branch(dipc)
  1060. Xdinstrn    *dipc;
  1061. X{
  1062. X    dinstrn    *dp;
  1063. X
  1064. X    if ((dp = addr_to_decoded_instrnp(dipc, dipc->di_addr + sizeof(unsigned long))) == (dinstrn *)0)
  1065. X        return -1;
  1066. X
  1067. X    dipc->di_1 = (unsigned long *)dp;
  1068. X
  1069. X    return 0;
  1070. X}
  1071. X
  1072. Xdinstrn    *
  1073. Xdo_delayed_branch(dipc, target)
  1074. Xdinstrn        *dipc;
  1075. Xunsigned long    target;
  1076. X{
  1077. X    dipc = addr_to_decoded_instrnp(dipc, dipc->di_addr + sizeof(unsigned long));
  1078. X
  1079. X    (void)(*dipc->di_handler)(dipc);
  1080. X
  1081. X    dipc = addr_to_decoded_instrnp(dipc, target);
  1082. X
  1083. X    dipc--;
  1084. X
  1085. X    return dipc;
  1086. X}
  1087. X
  1088. X#if    0
  1089. X#define    DIPC_TRACE    1
  1090. X#endif    /* 0 */
  1091. X
  1092. Xstatic
  1093. Xvoid
  1094. Xinterpret(dipc)
  1095. Xdinstrn    *dipc;
  1096. X{
  1097. X    for (;;)
  1098. X    {
  1099. X#if    DIPC_TRACE
  1100. Xprintf("0x%08x: ", dipc);
  1101. Xfflush(stdout);
  1102. Xprintf("0x%08x\n", dipc->di_handler);
  1103. Xfflush(stdout);
  1104. X        dipc = (*dipc->di_handler)(dipc) + 1;
  1105. X#else    /* DIPC_TRACE */
  1106. X        SIXTEENTIMES(dipc = (*dipc->di_handler)(dipc) + 1);
  1107. X#endif    /* DIPC_TRACE */
  1108. X    }
  1109. X}
  1110. X
  1111. X/*
  1112. X * Commence simulation of the process.
  1113. X */
  1114. Xint
  1115. Xgo()
  1116. X{
  1117. X    dinstrn    *idipc;
  1118. X
  1119. X    if (hist_length > 0 || Bflag || Hflag || Iflag || Mflag || Nflag || Rflag)
  1120. X        compile_ok = 0;
  1121. X    else
  1122. X        compile_ok = 1;
  1123. X
  1124. X    if ((idipc = addr_to_decoded_instrnp((dinstrn *)0, P.p_entry_point)) == (dinstrn *)0)
  1125. X        return -1;
  1126. X
  1127. X    interpret(idipc);
  1128. X}
  1129. END_OF_FILE
  1130. if test 8593 -ne `wc -c <'go.c'`; then
  1131.     echo shar: \"'go.c'\" unpacked with wrong size!
  1132. fi
  1133. # end of 'go.c'
  1134. fi
  1135. if test -f 'i_a.c' -a "${1}" != "-c" ; then 
  1136.   echo shar: Will not clobber existing file \"'i_a.c'\"
  1137. else
  1138. echo shar: Extracting \"'i_a.c'\" \(5388 characters\)
  1139. sed "s/^X//" >'i_a.c' <<'END_OF_FILE'
  1140. X#include    "register.h"
  1141. X#include    "symtab.h"
  1142. X#include    "diblock.h"
  1143. X#include    "instrn.h"
  1144. X#include    "process.h"
  1145. X
  1146. Xextern double    fabs();
  1147. X
  1148. Xdinstrn    *
  1149. Xi_absfmt(dipc, fmt, ft, fs, fd)
  1150. Xdinstrn    *dipc;
  1151. Xint    fmt;
  1152. Xint    ft;
  1153. Xint    fs;
  1154. Xint    fd;
  1155. X{
  1156. X    float    singles;
  1157. X    float    singled;
  1158. X    double    doubles;
  1159. X    double    doubled;
  1160. X
  1161. X    switch (fmt)
  1162. X    {
  1163. X    case FMT_SINGLE:
  1164. X        procsget(CP1G(fs), *(unsigned long *)&singles);
  1165. X
  1166. X        singled = (float)fabs(singles);
  1167. X
  1168. X        procsput(CP1G(fd), *(unsigned long *)&singled);
  1169. X
  1170. X        break;
  1171. X
  1172. X    case FMT_DOUBLE:
  1173. X        /*
  1174. X         * Note apparent reversal of words within
  1175. X         * doubles here -- no idea why.
  1176. X         */
  1177. X        procsget(CP1G(fs), *((unsigned long *)&doubles + 1));
  1178. X
  1179. X        procsget(CP1G(fs) + 1, *(unsigned long *)&doubles);
  1180. X
  1181. X        doubled = fabs(doubles);
  1182. X
  1183. X        procsput(CP1G(fd), *((unsigned long *)&doubled + 1));
  1184. X
  1185. X        procsput(CP1G(fd) + 1, *(unsigned long *)&doubled);
  1186. X        break;
  1187. X
  1188. X    default:
  1189. X        unrecognised(dipc);
  1190. X        break;
  1191. X    }
  1192. X
  1193. X    return dipc;
  1194. X}
  1195. X
  1196. Xdinstrn    *
  1197. Xi_add(dipc, rs, rt, rd, shamt, funct)
  1198. Xdinstrn    *dipc;
  1199. Xint    rs;
  1200. Xint    rt;
  1201. Xint    rd;
  1202. Xint    shamt;
  1203. Xint    funct;
  1204. X{
  1205. X    unsigned long    s;
  1206. X    unsigned long    t;
  1207. X
  1208. X    procsget(rs, s);
  1209. X
  1210. X    procsget(rt, t);
  1211. X
  1212. X    /*
  1213. X     * TODO -- overflow exception.
  1214. X     */
  1215. X    procsput(rd, s + t);
  1216. X
  1217. X    return dipc;
  1218. X}
  1219. X
  1220. Xdinstrn    *
  1221. Xi_addfmt(dipc, fmt, ft, fs, fd)
  1222. Xdinstrn    *dipc;
  1223. Xint    fmt;
  1224. Xint    ft;
  1225. Xint    fs;
  1226. Xint    fd;
  1227. X{
  1228. X    float        singles;
  1229. X    float        singlet;
  1230. X    float        singled;
  1231. X    double        doubles;
  1232. X    double        doublet;
  1233. X    double        doubled;
  1234. X    unsigned long    l[2];
  1235. X
  1236. X    switch (fmt)
  1237. X    {
  1238. X    case FMT_SINGLE:
  1239. X        procsget(CP1G(fs), *(unsigned long *)&singles);
  1240. X
  1241. X        procsget(CP1G(ft), *(unsigned long *)&singlet);
  1242. X
  1243. X        singled = singles + singlet;
  1244. X
  1245. X        procsput(CP1G(fd), *(unsigned long *)&singled);
  1246. X
  1247. X        break;
  1248. X
  1249. X    case FMT_DOUBLE:
  1250. X        /*
  1251. X         * Note apparent reversal of words within
  1252. X         * doubles here -- no idea why.
  1253. X         */
  1254. X        procsget(CP1G(fs), *((unsigned long *)&doubles + 1));
  1255. X
  1256. X        procsget(CP1G(fs) + 1, *(unsigned long *)&doubles);
  1257. X
  1258. X        procsget(CP1G(ft), *((unsigned long *)&doublet + 1));
  1259. X
  1260. X        procsget(CP1G(ft) + 1, *(unsigned long *)&doublet);
  1261. X
  1262. X        doubled = doubles + doublet;
  1263. X
  1264. X        procsput(CP1G(fd), *((unsigned long *)&doubled + 1));
  1265. X
  1266. X        procsput(CP1G(fd) + 1, *(unsigned long *)&doubled);
  1267. X        break;
  1268. X
  1269. X    default:
  1270. X        unrecognised(dipc);
  1271. X        break;
  1272. X    }
  1273. X
  1274. X    return dipc;
  1275. X}
  1276. X
  1277. Xstatic
  1278. Xdinstrn    *
  1279. Xc_addi_li(dipc)
  1280. Xdinstrn    *dipc;
  1281. X{
  1282. X    *dipc->di_0 = (long)dipc->di_2;
  1283. X
  1284. X    return dipc;
  1285. X}
  1286. X
  1287. Xstatic
  1288. Xdinstrn    *
  1289. Xc_addi(dipc)
  1290. Xdinstrn    *dipc;
  1291. X{
  1292. X    *dipc->di_0 = *dipc->di_1 + (long)dipc->di_2;
  1293. X
  1294. X    return dipc;
  1295. X}
  1296. X
  1297. Xdinstrn    *
  1298. Xi_addi(dipc, rs, rt, immediate)
  1299. Xdinstrn    *dipc;
  1300. Xint    rs;
  1301. Xint    rt;
  1302. Xshort    immediate;
  1303. X{
  1304. X    unsigned long    r;
  1305. X
  1306. X    if (compile_ok)
  1307. X    {
  1308. X        if (rt == R_0)
  1309. X            dipc->di_handler = c_noop;
  1310. X        else
  1311. X        {
  1312. X            if (rs == R_0)
  1313. X                dipc->di_handler = c_addi_li;
  1314. X            else
  1315. X                dipc->di_handler = c_addi;
  1316. X            dipc->di_0 = &P.p_state[rt];
  1317. X            dipc->di_1 = &P.p_state[rs];
  1318. X            dipc->di_2 = (unsigned long *)(long)immediate;
  1319. X        }
  1320. X
  1321. X        return (*dipc->di_handler)(dipc);
  1322. X    }
  1323. X
  1324. X    procsget(rs, r);
  1325. X
  1326. X    procsput(rt, r + immediate);
  1327. X
  1328. X    /*
  1329. X     * Overflow exception?
  1330. X     */
  1331. X
  1332. X    return dipc;
  1333. X}
  1334. X
  1335. Xstatic
  1336. Xdinstrn    *
  1337. Xc_addiu_li(dipc)
  1338. Xdinstrn    *dipc;
  1339. X{
  1340. X    *dipc->di_0 = (long)dipc->di_2;
  1341. X
  1342. X    return dipc;
  1343. X}
  1344. X
  1345. Xstatic
  1346. Xdinstrn    *
  1347. Xc_addiu(dipc)
  1348. Xdinstrn    *dipc;
  1349. X{
  1350. X    *dipc->di_0 = *dipc->di_1 + (long)dipc->di_2;
  1351. X
  1352. X    return dipc;
  1353. X}
  1354. X
  1355. Xdinstrn    *
  1356. Xi_addiu(dipc, rs, rt, immediate)
  1357. Xdinstrn    *dipc;
  1358. Xint    rs;
  1359. Xint    rt;
  1360. Xshort    immediate;
  1361. X{
  1362. X    unsigned long    s;
  1363. X
  1364. X    if (compile_ok)
  1365. X    {
  1366. X        if (rt == R_0)
  1367. X            dipc->di_handler = c_noop;
  1368. X        else
  1369. X        {
  1370. X            if (rs == R_0)
  1371. X                dipc->di_handler = c_addiu_li;
  1372. X            else
  1373. X                dipc->di_handler = c_addiu;
  1374. X            dipc->di_0 = &P.p_state[rt];
  1375. X            dipc->di_1 = &P.p_state[rs];
  1376. X            dipc->di_2 = (unsigned long *)(long)immediate;
  1377. X        }
  1378. X
  1379. X        return (*dipc->di_handler)(dipc);
  1380. X    }
  1381. X
  1382. X    procsget(rs, s);
  1383. X
  1384. X    procsput(rt, s + (long)immediate);
  1385. X
  1386. X    return dipc;
  1387. X}
  1388. X
  1389. Xstatic
  1390. Xdinstrn    *
  1391. Xc_addu_move(dipc)
  1392. Xdinstrn    *dipc;
  1393. X{
  1394. X    *dipc->di_0 = *dipc->di_2;
  1395. X
  1396. X    return dipc;
  1397. X}
  1398. X
  1399. Xstatic
  1400. Xdinstrn    *
  1401. Xc_addu_move2(dipc)
  1402. Xdinstrn    *dipc;
  1403. X{
  1404. X    *dipc->di_0 = *dipc->di_1;
  1405. X
  1406. X    return dipc;
  1407. X}
  1408. X
  1409. Xstatic
  1410. Xdinstrn    *
  1411. Xc_addu(dipc)
  1412. Xdinstrn    *dipc;
  1413. X{
  1414. X    *dipc->di_0 = *dipc->di_1 + *dipc->di_2;
  1415. X
  1416. X    return dipc;
  1417. X}
  1418. X
  1419. Xdinstrn    *
  1420. Xi_addu(dipc, rs, rt, rd, shamt, funct)
  1421. Xdinstrn    *dipc;
  1422. Xint    rs;
  1423. Xint    rt;
  1424. Xint    rd;
  1425. Xint    shamt;
  1426. Xint    funct;
  1427. X{
  1428. X    unsigned long    s;
  1429. X    unsigned long    t;
  1430. X
  1431. X    if (compile_ok)
  1432. X    {
  1433. X        if (rd == R_0)
  1434. X            dipc->di_handler = c_noop;
  1435. X        else
  1436. X        {
  1437. X            if (rs == R_0)
  1438. X                dipc->di_handler = c_addu_move;
  1439. X            else if (rt == R_0)
  1440. X                dipc->di_handler = c_addu_move2;
  1441. X            else
  1442. X                dipc->di_handler = c_addu;
  1443. X            dipc->di_0 = &P.p_state[rd];
  1444. X            dipc->di_1 = &P.p_state[rs];
  1445. X            dipc->di_2 = &P.p_state[rt];
  1446. X        }
  1447. X
  1448. X        return (*dipc->di_handler)(dipc);
  1449. X    }
  1450. X
  1451. X    procsget(rs, s);
  1452. X
  1453. X    procsget(rt, t);
  1454. X
  1455. X    procsput(rd, s + t);
  1456. X
  1457. X    return dipc;
  1458. X}
  1459. X
  1460. Xdinstrn    *
  1461. Xi_and(dipc, rs, rt, rd, shamt, funct)
  1462. Xdinstrn    *dipc;
  1463. Xint    rs;
  1464. Xint    rt;
  1465. Xint    rd;
  1466. Xint    shamt;
  1467. Xint    funct;
  1468. X{
  1469. X    unsigned long    s;
  1470. X    unsigned long    t;
  1471. X
  1472. X    procsget(rs, s);
  1473. X
  1474. X    procsget(rt, t);
  1475. X
  1476. X    procsput(rd, s & t);
  1477. X
  1478. X    return dipc;
  1479. X}
  1480. X
  1481. Xstatic
  1482. Xdinstrn    *
  1483. Xc_andi(dipc)
  1484. Xdinstrn    *dipc;
  1485. X{
  1486. X    *dipc->di_0 = *dipc->di_1 & (unsigned long)dipc->di_2;
  1487. X
  1488. X    return dipc;
  1489. X}
  1490. X
  1491. Xdinstrn    *
  1492. Xi_andi(dipc, rs, rt, immediate)
  1493. Xdinstrn    *dipc;
  1494. Xint    rs;
  1495. Xint    rt;
  1496. Xshort    immediate;
  1497. X{
  1498. X    unsigned long    s;
  1499. X
  1500. X    if (compile_ok)
  1501. X    {
  1502. X        if (rt == R_0)
  1503. X            dipc->di_handler = c_noop;
  1504. X        else
  1505. X        {
  1506. X            dipc->di_handler = c_andi;
  1507. X            dipc->di_0 = &P.p_state[rt];
  1508. X            dipc->di_1 = &P.p_state[rs];
  1509. X            dipc->di_2 = (unsigned long *)(((unsigned long)immediate) & 0xFFFF);
  1510. X        }
  1511. X
  1512. X        return (*dipc->di_handler)(dipc);
  1513. X    }
  1514. X
  1515. X    procsget(rs, s);
  1516. X
  1517. X    procsput(rt, s & (((unsigned long)immediate) & 0xFFFF));
  1518. X
  1519. X    return dipc;
  1520. X}
  1521. END_OF_FILE
  1522. if test 5388 -ne `wc -c <'i_a.c'`; then
  1523.     echo shar: \"'i_a.c'\" unpacked with wrong size!
  1524. fi
  1525. # end of 'i_a.c'
  1526. fi
  1527. if test -f 'i_b.c' -a "${1}" != "-c" ; then 
  1528.   echo shar: Will not clobber existing file \"'i_b.c'\"
  1529. else
  1530. echo shar: Extracting \"'i_b.c'\" \(5042 characters\)
  1531. sed "s/^X//" >'i_b.c' <<'END_OF_FILE'
  1532. X#include    "register.h"
  1533. X#include    "symtab.h"
  1534. X#include    "diblock.h"
  1535. X#include    "instrn.h"
  1536. X#include    "process.h"
  1537. X
  1538. Xdinstrn    *
  1539. Xi_bc1f(dipc, offset)
  1540. Xdinstrn    *dipc;
  1541. Xshort    offset;
  1542. X{
  1543. X    unsigned long    c;
  1544. X
  1545. X    procsget(CP1CS, c);
  1546. X
  1547. X    if (Test_Cond(c) == 0)
  1548. X        dipc = do_delayed_branch(dipc, (unsigned long)(dipc->di_addr + sizeof(unsigned long) + (((long)offset) << 2)));
  1549. X
  1550. X    return dipc;
  1551. X}
  1552. X
  1553. Xdinstrn    *
  1554. Xi_bc1t(dipc, offset)
  1555. Xdinstrn    *dipc;
  1556. Xshort    offset;
  1557. X{
  1558. X    unsigned long    c;
  1559. X
  1560. X    procsget(CP1CS, c);
  1561. X
  1562. X    if (Test_Cond(c) == 1)
  1563. X        dipc = do_delayed_branch(dipc, (unsigned long)(dipc->di_addr + sizeof(unsigned long) + (((long)offset) << 2)));
  1564. X
  1565. X    return dipc;
  1566. X}
  1567. X
  1568. Xstatic
  1569. Xdinstrn    *
  1570. Xc_beq0(dipc)
  1571. Xdinstrn    *dipc;
  1572. X{
  1573. X    if (*dipc->di_0 == 0)
  1574. X        do_known_delayed_branch;
  1575. X
  1576. X    return dipc;
  1577. X}
  1578. X
  1579. Xstatic
  1580. Xdinstrn    *
  1581. Xc_beq0_up(dipc)
  1582. Xdinstrn    *dipc;
  1583. X{
  1584. X    if (*dipc->di_0 == 0)
  1585. X        do_known_delayed_upbranch;
  1586. X
  1587. X    return dipc;
  1588. X}
  1589. X
  1590. Xstatic
  1591. Xdinstrn    *
  1592. Xc_beq(dipc)
  1593. Xdinstrn    *dipc;
  1594. X{
  1595. X    if (*dipc->di_0 == *dipc->di_1)
  1596. X        do_known_delayed_branch;
  1597. X
  1598. X    return dipc;
  1599. X}
  1600. X
  1601. Xstatic
  1602. Xdinstrn    *
  1603. Xc_beq_up(dipc)
  1604. Xdinstrn    *dipc;
  1605. X{
  1606. X    if (*dipc->di_0 == *dipc->di_1)
  1607. X        do_known_delayed_upbranch;
  1608. X
  1609. X    return dipc;
  1610. X}
  1611. X
  1612. Xdinstrn    *
  1613. Xi_beq(dipc, rs, rt, offset)
  1614. Xdinstrn    *dipc;
  1615. Xint    rs;
  1616. Xint    rt;
  1617. Xshort    offset;
  1618. X{
  1619. X    unsigned long    s;
  1620. X    unsigned long    t;
  1621. X    unsigned long    target;
  1622. X
  1623. X    target = dipc->di_addr + sizeof(unsigned long) + (((long)offset) << 2);
  1624. X
  1625. X    if (compile_ok)
  1626. X    {
  1627. X        if (rt == R_0)
  1628. X            dipc->di_handler = (target > dipc->di_addr) ? c_beq0 : c_beq0_up;
  1629. X        else
  1630. X            dipc->di_handler = (target > dipc->di_addr) ? c_beq : c_beq_up;
  1631. X
  1632. X        dipc->di_0 = &P.p_state[rs];
  1633. X        dipc->di_1 = &P.p_state[rt];
  1634. X
  1635. X        (void)compile_known_delayed_branch(dipc, target);
  1636. X
  1637. X        return (*dipc->di_handler)(dipc);
  1638. X    }
  1639. X
  1640. X    procsget(rs, s);
  1641. X
  1642. X    procsget(rt, t);
  1643. X
  1644. X    if (s == t)
  1645. X        dipc = do_delayed_branch(dipc, target);
  1646. X
  1647. X    return dipc;
  1648. X}
  1649. X
  1650. Xstatic
  1651. Xdinstrn    *
  1652. Xc_bgez(dipc)
  1653. Xdinstrn    *dipc;
  1654. X{
  1655. X    if ((long)*dipc->di_0 >= 0)
  1656. X        do_known_delayed_branch;
  1657. X
  1658. X    return dipc;
  1659. X}
  1660. X
  1661. Xstatic
  1662. Xdinstrn    *
  1663. Xc_bgez_up(dipc)
  1664. Xdinstrn    *dipc;
  1665. X{
  1666. X    if ((long)*dipc->di_0 >= 0)
  1667. X        do_known_delayed_upbranch;
  1668. X
  1669. X    return dipc;
  1670. X}
  1671. X
  1672. Xdinstrn    *
  1673. Xi_bgez(dipc, rs, rt, offset)
  1674. Xdinstrn    *dipc;
  1675. Xint    rs;
  1676. Xint    rt;
  1677. Xshort    offset;
  1678. X{
  1679. X    unsigned long    target;
  1680. X    long        s;
  1681. X
  1682. X    target = dipc->di_addr + sizeof(unsigned long) + (((long)offset) << 2);
  1683. X
  1684. X    if (compile_ok)
  1685. X    {
  1686. X        dipc->di_handler = c_bgez;
  1687. X        dipc->di_handler = (target > dipc->di_addr) ? c_bgez : c_bgez_up;
  1688. X        dipc->di_0 = &P.p_state[rs];
  1689. X        (void)compile_known_delayed_branch(dipc, target);
  1690. X
  1691. X        return (*dipc->di_handler)(dipc);
  1692. X    }
  1693. X
  1694. X    procsget(rs, *(unsigned long *)&s);
  1695. X
  1696. X    if (s >= 0)
  1697. X        dipc = do_delayed_branch(dipc, target);
  1698. X
  1699. X    return dipc;
  1700. X}
  1701. X
  1702. Xstatic
  1703. Xdinstrn    *
  1704. Xc_bgtz(dipc)
  1705. Xdinstrn    *dipc;
  1706. X{
  1707. X    if ((long)*dipc->di_0 > 0)
  1708. X        do_known_delayed_branch;
  1709. X
  1710. X    return dipc;
  1711. X}
  1712. X
  1713. Xstatic
  1714. Xdinstrn    *
  1715. Xc_bgtz_up(dipc)
  1716. Xdinstrn    *dipc;
  1717. X{
  1718. X    if ((long)*dipc->di_0 > 0)
  1719. X        do_known_delayed_upbranch;
  1720. X
  1721. X    return dipc;
  1722. X}
  1723. X
  1724. Xdinstrn    *
  1725. Xi_bgtz(dipc, rs, rt, offset)
  1726. Xdinstrn    *dipc;
  1727. Xint    rs;
  1728. Xint    rt;
  1729. Xshort    offset;
  1730. X{
  1731. X    unsigned long    target;
  1732. X    long        s;
  1733. X
  1734. X    target = dipc->di_addr + sizeof(unsigned long) + (((long)offset) << 2);
  1735. X
  1736. X    if (compile_ok)
  1737. X    {
  1738. X        dipc->di_handler = (target > dipc->di_addr) ? c_bgtz : c_bgtz_up;
  1739. X        dipc->di_0 = &P.p_state[rs];
  1740. X        (void)compile_known_delayed_branch(dipc, target);
  1741. X
  1742. X        return (*dipc->di_handler)(dipc);
  1743. X    }
  1744. X
  1745. X    procsget(rs, *(unsigned long *)&s);
  1746. X
  1747. X    if (s > 0)
  1748. X        dipc = do_delayed_branch(dipc, target);
  1749. X
  1750. X    return dipc;
  1751. X}
  1752. X
  1753. Xdinstrn    *
  1754. Xi_blez(dipc, rs, rt, offset)
  1755. Xdinstrn    *dipc;
  1756. Xint    rs;
  1757. Xint    rt;
  1758. Xshort    offset;
  1759. X{
  1760. X    long    s;
  1761. X
  1762. X    procsget(rs, *(unsigned long *)&s);
  1763. X
  1764. X    if (s <= 0)
  1765. X        dipc = do_delayed_branch(dipc, (unsigned long)(dipc->di_addr + sizeof(unsigned long) + (((long)offset) << 2)));
  1766. X
  1767. X    return dipc;
  1768. X}
  1769. X
  1770. Xdinstrn    *
  1771. Xi_bltz(dipc, rs, rt, offset)
  1772. Xdinstrn    *dipc;
  1773. Xint    rs;
  1774. Xint    rt;
  1775. Xshort    offset;
  1776. X{
  1777. X    long    s;
  1778. X
  1779. X    procsget(rs, *(unsigned long *)&s);
  1780. X
  1781. X    if (s < 0)
  1782. X        dipc = do_delayed_branch(dipc, (unsigned long)(dipc->di_addr + sizeof(unsigned long) + (((long)offset) << 2)));
  1783. X
  1784. X    return dipc;
  1785. X}
  1786. X
  1787. Xstatic
  1788. Xdinstrn    *
  1789. Xc_bne0(dipc)
  1790. Xdinstrn    *dipc;
  1791. X{
  1792. X    if (*dipc->di_0 != 0)
  1793. X        do_known_delayed_branch;
  1794. X
  1795. X    return dipc;
  1796. X}
  1797. X
  1798. Xstatic
  1799. Xdinstrn    *
  1800. Xc_bne0_up(dipc)
  1801. Xdinstrn    *dipc;
  1802. X{
  1803. X    if (*dipc->di_0 != 0)
  1804. X        do_known_delayed_upbranch;
  1805. X
  1806. X    return dipc;
  1807. X}
  1808. X
  1809. Xstatic
  1810. Xdinstrn    *
  1811. Xc_bne(dipc)
  1812. Xdinstrn    *dipc;
  1813. X{
  1814. X    if (*dipc->di_0 != *dipc->di_1)
  1815. X        do_known_delayed_branch;
  1816. X
  1817. X    return dipc;
  1818. X}
  1819. X
  1820. Xstatic
  1821. Xdinstrn    *
  1822. Xc_bne_up(dipc)
  1823. Xdinstrn    *dipc;
  1824. X{
  1825. X    if (*dipc->di_0 != *dipc->di_1)
  1826. X        do_known_delayed_upbranch;
  1827. X
  1828. X    return dipc;
  1829. X}
  1830. X
  1831. Xdinstrn    *
  1832. Xi_bne(dipc, rs, rt, offset)
  1833. Xdinstrn    *dipc;
  1834. Xint    rs;
  1835. Xint    rt;
  1836. Xshort    offset;
  1837. X{
  1838. X    unsigned long    target;
  1839. X    unsigned long    s;
  1840. X    unsigned long    t;
  1841. X
  1842. X    target = dipc->di_addr + sizeof(unsigned long) + (((long)offset) << 2);
  1843. X
  1844. X    if (compile_ok)
  1845. X    {
  1846. X        if (rt == R_0)
  1847. X            dipc->di_handler = (target > dipc->di_addr) ? c_bne0 : c_bne0_up;
  1848. X        else
  1849. X            dipc->di_handler = (target > dipc->di_addr) ? c_bne : c_bne_up;
  1850. X
  1851. X        dipc->di_0 = &P.p_state[rs];
  1852. X        dipc->di_1 = &P.p_state[rt];
  1853. X        (void)compile_known_delayed_branch(dipc, target);
  1854. X
  1855. X        return (*dipc->di_handler)(dipc);
  1856. X    }
  1857. X
  1858. X    procsget(rs, s);
  1859. X
  1860. X    procsget(rt, t);
  1861. X
  1862. X    if (s != t)
  1863. X        dipc = do_delayed_branch(dipc, target);
  1864. X
  1865. X    return dipc;
  1866. X}
  1867. END_OF_FILE
  1868. if test 5042 -ne `wc -c <'i_b.c'`; then
  1869.     echo shar: \"'i_b.c'\" unpacked with wrong size!
  1870. fi
  1871. # end of 'i_b.c'
  1872. fi
  1873. if test -f 'i_l.c' -a "${1}" != "-c" ; then 
  1874.   echo shar: Will not clobber existing file \"'i_l.c'\"
  1875. else
  1876. echo shar: Extracting \"'i_l.c'\" \(8549 characters\)
  1877. sed "s/^X//" >'i_l.c' <<'END_OF_FILE'
  1878. X#include    <stdio.h>
  1879. X#include    "register.h"
  1880. X#include    "symtab.h"
  1881. X#include    "diblock.h"
  1882. X#include    "instrn.h"
  1883. X#include    "process.h"
  1884. X#include    "wcache.h"
  1885. X#include    "talloc.h"
  1886. X#include    "nels.h"
  1887. X
  1888. X#define    char_to_signed_long(C)    (long)(((C) & 0x80) ? ((C) | 0xFFFFFF80) : (C))
  1889. X
  1890. X#define    quiet_procmget_word(dipc,offset,ip,n,S,T) \
  1891. X{ \
  1892. X    int        i; \
  1893. X    unsigned long    *wp; \
  1894. X \
  1895. X    if ((i = offset - P.p_data_region_min) >= 0) \
  1896. X    { \
  1897. X        if (n == sizeof(int)) \
  1898. X        { \
  1899. X            if (offset <= P.p_data_region_wlimit) \
  1900. X            { \
  1901. X                wp = (unsigned long *)&P.p_data_region[i]; \
  1902. X                *ip = *wp; \
  1903. X                S; \
  1904. X                T; \
  1905. X                return dipc; \
  1906. X            } \
  1907. X        } \
  1908. X        else if (n == sizeof(short)) \
  1909. X        { \
  1910. X            if (offset <= P.p_data_region_limit + 1 - n) \
  1911. X            { \
  1912. X                *ip = *(unsigned short *)&P.p_data_region[i]; \
  1913. X                S; \
  1914. X                T; \
  1915. X                return dipc; \
  1916. X            } \
  1917. X        } \
  1918. X        else \
  1919. X        { \
  1920. X            if (offset <= P.p_data_region_limit) \
  1921. X            { \
  1922. X                *ip = *(unsigned char *)&P.p_data_region[i]; \
  1923. X                S; \
  1924. X                T; \
  1925. X                return dipc; \
  1926. X            } \
  1927. X        } \
  1928. X \
  1929. X        if (offset <= STACK_WMAX) \
  1930. X        { \
  1931. X            if ((i = offset - P.p_stack_region_min) < 0) \
  1932. X            { \
  1933. X                (void)proc_grow_stack(dipc, offset); \
  1934. X \
  1935. X                i = offset - P.p_stack_region_min; \
  1936. X            } \
  1937. X \
  1938. X            if (n == sizeof(int)) \
  1939. X            { \
  1940. X                wp = (unsigned long *)&P.p_stack_region[i]; \
  1941. X                *ip = *wp; \
  1942. X            } \
  1943. X            else if (n == sizeof(short)) \
  1944. X                *ip = *(unsigned short *)&P.p_stack_region[i]; \
  1945. X            else \
  1946. X                *ip = *(unsigned char *)&P.p_stack_region[i]; \
  1947. X \
  1948. X            S; \
  1949. X            T; \
  1950. X            return dipc; \
  1951. X        } \
  1952. X    } \
  1953. X \
  1954. X    (void)quiet_procmget(dipc, offset, (unsigned char *)ip, n); \
  1955. X    S; \
  1956. X    return dipc; \
  1957. X}
  1958. X
  1959. Xstatic
  1960. Xdinstrn    *
  1961. Xc_lb0(dipc)
  1962. Xdinstrn    *dipc;
  1963. X{
  1964. X    unsigned long    addr;
  1965. X    unsigned char    c;
  1966. X    unsigned long    *lp;
  1967. X
  1968. X    addr = *dipc->di_1;
  1969. X    lp = dipc->di_0;
  1970. X
  1971. X    quiet_procmget_word(dipc, addr, &c, sizeof(c), *lp = (unsigned long)char_to_signed_long(c), ;);
  1972. X}
  1973. X
  1974. Xstatic
  1975. Xdinstrn    *
  1976. Xc_lb(dipc)
  1977. Xdinstrn    *dipc;
  1978. X{
  1979. X    unsigned long    addr;
  1980. X    unsigned char    c;
  1981. X    unsigned long    *lp;
  1982. X
  1983. X    addr = *dipc->di_1 + (long)dipc->di_2;
  1984. X    lp = dipc->di_0;
  1985. X
  1986. X    quiet_procmget_word(dipc, addr, &c, sizeof(c), *lp = (unsigned long)char_to_signed_long(c), ;);
  1987. X}
  1988. X
  1989. Xdinstrn    *
  1990. Xi_lb(dipc, base, rt, offset)
  1991. Xdinstrn    *dipc;
  1992. Xint    base;
  1993. Xint    rt;
  1994. Xshort    offset;
  1995. X{
  1996. X    unsigned long    b;
  1997. X    unsigned char    c;
  1998. X
  1999. X    if (compile_ok)
  2000. X    {
  2001. X        if (rt == R_0)
  2002. X            dipc->di_handler = c_noop;
  2003. X        else
  2004. X        {
  2005. X            if (offset == (short)0)
  2006. X                dipc->di_handler = c_lb0;
  2007. X            else
  2008. X                dipc->di_handler = c_lb;
  2009. X            dipc->di_0 = &P.p_state[rt];
  2010. X            dipc->di_1 = &P.p_state[base];
  2011. X            dipc->di_2 = (unsigned long *)(long)offset;
  2012. X        }
  2013. X
  2014. X        return (*dipc->di_handler)(dipc);
  2015. X    }
  2016. X
  2017. X    procsget(base, b);
  2018. X
  2019. X    if (procmget(dipc, b + (long)offset, (char *)&c, sizeof(c)) != -1)
  2020. X        procsput(rt, char_to_signed_long(c));
  2021. X
  2022. X    return dipc;
  2023. X}
  2024. X
  2025. Xstatic
  2026. Xdinstrn    *
  2027. Xc_lbu(dipc)
  2028. Xdinstrn    *dipc;
  2029. X{
  2030. X    unsigned long    addr;
  2031. X    unsigned char    c;
  2032. X    unsigned long    *lp;
  2033. X
  2034. X    addr = *dipc->di_1 + (long)dipc->di_2;
  2035. X    lp = dipc->di_0;
  2036. X
  2037. X    quiet_procmget_word(dipc, addr, &c, sizeof(c), *lp = (unsigned long)c, ;);
  2038. X}
  2039. X
  2040. Xdinstrn    *
  2041. Xi_lbu(dipc, base, rt, offset)
  2042. Xdinstrn    *dipc;
  2043. Xint    base;
  2044. Xint    rt;
  2045. Xshort    offset;
  2046. X{
  2047. X    unsigned long    b;
  2048. X    unsigned char    c;
  2049. X
  2050. X    if (compile_ok)
  2051. X    {
  2052. X        if (rt == R_0)
  2053. X            dipc->di_handler = c_noop;
  2054. X        else
  2055. X        {
  2056. X            dipc->di_handler = c_lbu;
  2057. X            dipc->di_0 = &P.p_state[rt];
  2058. X            dipc->di_1 = &P.p_state[base];
  2059. X            dipc->di_2 = (unsigned long *)(long)offset;
  2060. X        }
  2061. X
  2062. X        return (*dipc->di_handler)(dipc);
  2063. X    }
  2064. X
  2065. X    procsget(base, b);
  2066. X
  2067. X    if (procmget(dipc, b + (long)offset, (char *)&c, sizeof(c)) != -1)
  2068. X        procsput(rt, (unsigned long)c);
  2069. X
  2070. X    return dipc;
  2071. X}
  2072. X
  2073. Xstatic
  2074. Xdinstrn    *
  2075. Xc_lh(dipc)
  2076. Xdinstrn    *dipc;
  2077. X{
  2078. X    unsigned long    addr;
  2079. X    unsigned long    *lp;
  2080. X    short        m;
  2081. X
  2082. X    addr = *dipc->di_1 + (long)dipc->di_2;
  2083. X    lp = dipc->di_0;
  2084. X
  2085. X    check_halfword_align(dipc, addr);
  2086. X
  2087. X    quiet_procmget_word(dipc, addr, &m, sizeof(m), *lp = (unsigned long)(long)m, ;);
  2088. X}
  2089. X
  2090. Xdinstrn    *
  2091. Xi_lh(dipc, base, rt, offset)
  2092. Xdinstrn    *dipc;
  2093. Xint    base;
  2094. Xint    rt;
  2095. Xshort    offset;
  2096. X{
  2097. X    unsigned long    b;
  2098. X    unsigned long    addr;
  2099. X    short        m;
  2100. X
  2101. X    if (compile_ok)
  2102. X    {
  2103. X        if (rt == R_0)
  2104. X            dipc->di_handler = c_noop;
  2105. X        else
  2106. X        {
  2107. X            dipc->di_handler = c_lh;
  2108. X            dipc->di_0 = &P.p_state[rt];
  2109. X            dipc->di_1 = &P.p_state[base];
  2110. X            dipc->di_2 = (unsigned long *)(long)offset;
  2111. X        }
  2112. X
  2113. X        return (*dipc->di_handler)(dipc);
  2114. X    }
  2115. X
  2116. X    procsget(base, b);
  2117. X
  2118. X    addr = b + (long)offset;
  2119. X
  2120. X    check_halfword_align(dipc, addr);
  2121. X
  2122. X    if (procmget(dipc, addr, (char *)&m, sizeof(m)) != -1)
  2123. X        procsput(rt, (long)m);
  2124. X
  2125. X    return dipc;
  2126. X}
  2127. X
  2128. Xdinstrn    *
  2129. Xi_lhu(dipc, base, rt, offset)
  2130. Xdinstrn    *dipc;
  2131. Xint    base;
  2132. Xint    rt;
  2133. Xshort    offset;
  2134. X{
  2135. X    unsigned long    b;
  2136. X    unsigned long    addr;
  2137. X    unsigned short    m;
  2138. X
  2139. X    procsget(base, b);
  2140. X
  2141. X    addr = b + (long)offset;
  2142. X
  2143. X    check_halfword_align(dipc, addr);
  2144. X
  2145. X    if (procmget(dipc, addr, (char *)&m, sizeof(m)) != -1)
  2146. X        procsput(rt, (unsigned long)m);
  2147. X
  2148. X    return dipc;
  2149. X}
  2150. X
  2151. Xstatic
  2152. Xdinstrn    *
  2153. Xc_lui(dipc)
  2154. Xdinstrn    *dipc;
  2155. X{
  2156. X    *dipc->di_0 = (unsigned long)dipc->di_1;
  2157. X
  2158. X    return dipc;
  2159. X}
  2160. X
  2161. Xdinstrn    *
  2162. Xi_lui(dipc, rs, rt, immediate)
  2163. Xdinstrn    *dipc;
  2164. Xint    rs;
  2165. Xint    rt;
  2166. Xshort    immediate;
  2167. X{
  2168. X    unsigned long    t;
  2169. X
  2170. X    if (compile_ok)
  2171. X    {
  2172. X        if (rt == R_0)
  2173. X            dipc->di_handler = c_noop;
  2174. X        else
  2175. X        {
  2176. X            dipc->di_handler = c_lui;
  2177. X            dipc->di_0 = &P.p_state[rt];
  2178. X            dipc->di_1 = (unsigned long *)((immediate << 16) & 0xFFFF0000);
  2179. X        }
  2180. X
  2181. X        return (*dipc->di_handler)(dipc);
  2182. X    }
  2183. X
  2184. X    t = (immediate << 16) & 0xFFFF0000;
  2185. X
  2186. X    procsput(rt, t);
  2187. X
  2188. X    return dipc;
  2189. X}
  2190. X
  2191. Xstatic
  2192. Xdinstrn    *
  2193. Xc_lw0(dipc)
  2194. Xdinstrn    *dipc;
  2195. X{
  2196. X    unsigned long    addr;
  2197. X    unsigned long    *lp;
  2198. X    cent        *cap;
  2199. X
  2200. X    addr = *dipc->di_1;
  2201. X    lp = dipc->di_0;
  2202. X
  2203. X    if ((cap = &wcache[addr % CACHEZ])->c_addr == addr)
  2204. X    {
  2205. X        *lp = *cap->c_ptr;
  2206. X        return dipc;
  2207. X    }
  2208. X
  2209. X    check_word_align(dipc, addr);
  2210. X
  2211. X    quiet_procmget_word(dipc, addr, lp, sizeof(*lp), ;, cap->c_ptr = wp; cap->c_addr = addr);
  2212. X}
  2213. X
  2214. Xstatic
  2215. Xdinstrn    *
  2216. Xc_lw4(dipc)
  2217. Xdinstrn    *dipc;
  2218. X{
  2219. X    unsigned long    addr;
  2220. X    unsigned long    *lp;
  2221. X    cent        *cap;
  2222. X
  2223. X    addr = *dipc->di_1 + 4;
  2224. X    lp = dipc->di_0;
  2225. X
  2226. X    if ((cap = &wcache[addr % CACHEZ])->c_addr == addr)
  2227. X    {
  2228. X        *lp = *cap->c_ptr;
  2229. X        return dipc;
  2230. X    }
  2231. X
  2232. X    check_word_align(dipc, addr);
  2233. X
  2234. X    quiet_procmget_word(dipc, addr, lp, sizeof(*lp), ;, cap->c_ptr = wp; cap->c_addr = addr);
  2235. X}
  2236. X
  2237. Xstatic
  2238. Xdinstrn    *
  2239. Xc_lw8(dipc)
  2240. Xdinstrn    *dipc;
  2241. X{
  2242. X    unsigned long    addr;
  2243. X    unsigned long    *lp;
  2244. X    cent        *cap;
  2245. X
  2246. X    addr = *dipc->di_1 + 8;
  2247. X    lp = dipc->di_0;
  2248. X
  2249. X    if ((cap = &wcache[addr % CACHEZ])->c_addr == addr)
  2250. X    {
  2251. X        *lp = *cap->c_ptr;
  2252. X        return dipc;
  2253. X    }
  2254. X
  2255. X    check_word_align(dipc, addr);
  2256. X
  2257. X    quiet_procmget_word(dipc, addr, lp, sizeof(*lp), ;, cap->c_ptr = wp; cap->c_addr = addr);
  2258. X}
  2259. X
  2260. Xstatic
  2261. Xdinstrn    *
  2262. Xc_lw(dipc)
  2263. Xdinstrn    *dipc;
  2264. X{
  2265. X    unsigned long    addr;
  2266. X    unsigned long    *lp;
  2267. X    cent        *cap;
  2268. X
  2269. X    addr = *dipc->di_1 + (long)dipc->di_2;
  2270. X    lp = dipc->di_0;
  2271. X
  2272. X    if ((cap = &wcache[addr % CACHEZ])->c_addr == addr)
  2273. X    {
  2274. X        *lp = *cap->c_ptr;
  2275. X        return dipc;
  2276. X    }
  2277. X
  2278. X    check_word_align(dipc, addr);
  2279. X
  2280. X    quiet_procmget_word(dipc, addr, lp, sizeof(*lp), ;, cap->c_ptr = wp; cap->c_addr = addr);
  2281. X}
  2282. X
  2283. Xdinstrn    *
  2284. Xi_lw(dipc, base, rt, offset)
  2285. Xdinstrn    *dipc;
  2286. Xint    base;
  2287. Xint    rt;
  2288. Xshort    offset;
  2289. X{
  2290. X    unsigned long    b;
  2291. X    unsigned long    addr;
  2292. X    unsigned long    t;
  2293. X
  2294. X    if (compile_ok)
  2295. X    {
  2296. X        if (rt == R_0)
  2297. X            dipc->di_handler = c_noop;
  2298. X        else
  2299. X        {
  2300. X            switch (offset)
  2301. X            {
  2302. X            case 0:
  2303. X                dipc->di_handler = c_lw0;
  2304. X                break;
  2305. X
  2306. X            case 4:
  2307. X                dipc->di_handler = c_lw4;
  2308. X                break;
  2309. X
  2310. X            case 8:
  2311. X                dipc->di_handler = c_lw8;
  2312. X                break;
  2313. X
  2314. X            default:
  2315. X                dipc->di_handler = c_lw;
  2316. X                break;
  2317. X            }
  2318. X            dipc->di_0 = &P.p_state[rt];
  2319. X            dipc->di_1 = &P.p_state[base];
  2320. X            dipc->di_2 = (unsigned long *)(long)offset;
  2321. X        }
  2322. X
  2323. X        return (*dipc->di_handler)(dipc);
  2324. X    }
  2325. X
  2326. X    procsget(base, b);
  2327. X
  2328. X    addr = b + (long)offset;
  2329. X
  2330. X    check_word_align(dipc, addr);
  2331. X
  2332. X    if (procmget(dipc, addr, (char *)&t, sizeof(t)) != -1)
  2333. X        procsput(rt, t);
  2334. X
  2335. X    return dipc;
  2336. X}
  2337. X
  2338. Xdinstrn    *
  2339. Xi_lwc1(dipc, base, rt, offset)
  2340. Xdinstrn    *dipc;
  2341. Xint    base;
  2342. Xint    rt;
  2343. Xshort    offset;
  2344. X{
  2345. X    unsigned long    b;
  2346. X    unsigned long    addr;
  2347. X    unsigned long    t;
  2348. X
  2349. X    procsget(base, b);
  2350. X
  2351. X    addr = b + (long)offset;
  2352. X
  2353. X    check_word_align(dipc, addr);
  2354. X
  2355. X    if (procmget(dipc, addr, (char *)&t, sizeof(t)) != -1)
  2356. X        procsput(CP1G(rt), t);
  2357. X
  2358. X    return dipc;
  2359. X}
  2360. X
  2361. Xdinstrn    *
  2362. Xi_lwl(dipc, base, rt, offset)
  2363. Xdinstrn    *dipc;
  2364. Xint    base;
  2365. Xint    rt;
  2366. Xshort    offset;
  2367. X{
  2368. X    unsigned long    b;
  2369. X    unsigned long    addr;
  2370. X    unsigned long    t;
  2371. X    int        length;
  2372. X
  2373. X    procsget(base, b);
  2374. X
  2375. X    addr = b + offset;
  2376. X
  2377. X    procsget(rt, t);
  2378. X
  2379. X    length = sizeof(t) - (addr - (addr & ~0x3));
  2380. X
  2381. X    if (procmget(dipc, addr, (unsigned char *)&t, length) != -1)
  2382. X        procsput(rt, t);
  2383. X
  2384. X    return dipc;
  2385. X}
  2386. X
  2387. Xdinstrn    *
  2388. Xi_lwr(dipc, base, rt, offset)
  2389. Xdinstrn    *dipc;
  2390. Xint    base;
  2391. Xint    rt;
  2392. Xshort    offset;
  2393. X{
  2394. X    unsigned long    b;
  2395. X    unsigned long    addr;
  2396. X    unsigned long    t;
  2397. X    int        length;
  2398. X
  2399. X    procsget(base, b);
  2400. X
  2401. X    addr = b + offset;
  2402. X
  2403. X    procsget(rt, t);
  2404. X
  2405. X    length = (addr - (addr & ~0x3)) + 1;
  2406. X
  2407. X    if (procmget(dipc, addr & ~0x3, ((unsigned char *)&t) + (sizeof(t) - length), length) != -1)
  2408. X        procsput(rt, t);
  2409. X
  2410. X    return dipc;
  2411. X}
  2412. END_OF_FILE
  2413. if test 8549 -ne `wc -c <'i_l.c'`; then
  2414.     echo shar: \"'i_l.c'\" unpacked with wrong size!
  2415. fi
  2416. # end of 'i_l.c'
  2417. fi
  2418. if test -f 'load.c' -a "${1}" != "-c" ; then 
  2419.   echo shar: Will not clobber existing file \"'load.c'\"
  2420. else
  2421. echo shar: Extracting \"'load.c'\" \(5439 characters\)
  2422. sed "s/^X//" >'load.c' <<'END_OF_FILE'
  2423. X#include    <sys/param.h>
  2424. X#include    <sys/types.h>
  2425. X#include    <sys/immu.h>
  2426. X#include    <fcntl.h>
  2427. X#include    <unistd.h>
  2428. X#include    <stdio.h>
  2429. X#include    "register.h"
  2430. X#include    "symtab.h"
  2431. X#include    "diblock.h"
  2432. X#include    "instrn.h"
  2433. X#include    "process.h"
  2434. X
  2435. X#if    0
  2436. X#define    LOAD_DEBUG    1
  2437. X#endif    /* 0 */
  2438. X
  2439. Xextern int    get_interpreter_data();
  2440. Xextern int    fd_hold();
  2441. Xextern int    fd_release();
  2442. X
  2443. Xextern int    errno;
  2444. X
  2445. Xextern FILE    *outfp;
  2446. Xextern int    Vflag;
  2447. X
  2448. Xstatic int    init_stack();
  2449. X
  2450. X/*
  2451. X * Create a new process environment
  2452. X * and initialise its components.
  2453. X */
  2454. Xint
  2455. Xload(adotout, argp, envp)
  2456. Xchar    *adotout;
  2457. Xchar    **argp;
  2458. Xchar    **envp;
  2459. X{
  2460. X    char    *interpreter_name;
  2461. X    char    *interpreter_arg;
  2462. X    char    **cp;
  2463. X
  2464. X    if (Vflag)
  2465. X    {
  2466. X        fprintf(outfp, "load(adotout=\"%s\",argp={", adotout);
  2467. X        for (cp = argp; *cp != (char *)0; cp++)
  2468. X            fprintf(outfp, "\"%s\",", *cp);
  2469. X        fprintf(outfp, "},envp={");
  2470. X        for (cp = envp; *cp != (char *)0; cp++)
  2471. X            fprintf(outfp, "\"%s\",", *cp);
  2472. X        fprintf(outfp, "})\n");
  2473. X    }
  2474. X
  2475. X    interpreter_name = (char *)0;
  2476. X    interpreter_arg = (char *)0;
  2477. X
  2478. X    if (get_interpreter_data(adotout, &interpreter_name, &interpreter_arg) == 0)
  2479. X    {
  2480. X        char    **nargp;
  2481. X
  2482. X        /*
  2483. X         * It's an executable interpreter script.
  2484. X         */
  2485. X        for (cp = argp; *cp != (char *)0; cp++)
  2486. X            ;
  2487. X
  2488. X        cp++;
  2489. X
  2490. X        cp++;
  2491. X
  2492. X        if (interpreter_arg != (char *)0)
  2493. X            cp++;
  2494. X
  2495. X        if ((nargp = (char **)malloc((cp - argp) * sizeof(*cp))) == (char **)0)
  2496. X        {
  2497. X            vcouldnot("allocate space for duplicate argv: load()");
  2498. X            return -1;
  2499. X        }
  2500. X
  2501. X        cp = nargp;
  2502. X
  2503. X        *cp++ = argp[0];
  2504. X
  2505. X        if (interpreter_arg != (char *)0)
  2506. X            *cp++ = interpreter_arg;
  2507. X
  2508. X        *cp++ = adotout;
  2509. X
  2510. X        {
  2511. X            int    argi;
  2512. X
  2513. X            for (argi = 1; argp[argi] != (char *)0; argi++)
  2514. X                *cp++ = argp[argi];
  2515. X
  2516. X            *cp = (char *)0;
  2517. X        }
  2518. X
  2519. X        adotout = interpreter_name;
  2520. X        argp = nargp;
  2521. X
  2522. X        if (Vflag)
  2523. X        {
  2524. X            fprintf(outfp, "load'(adotout=\"%s\",argp={", adotout);
  2525. X            for (cp = argp; *cp != (char *)0; cp++)
  2526. X                fprintf(outfp, "\"%s\",", *cp);
  2527. X            fprintf(outfp, "},envp={");
  2528. X            for (cp = envp; *cp != (char *)0; cp++)
  2529. X                fprintf(outfp, "\"%s\",", *cp);
  2530. X            fprintf(outfp, "})\n");
  2531. X        }
  2532. X    }
  2533. X
  2534. X    if (fd_release() == -1)
  2535. X        return -1;
  2536. X
  2537. X    /*
  2538. X     * Create a new process execution
  2539. X     * environment.
  2540. X     */
  2541. X    if (procopen(adotout) == -1)
  2542. X    {
  2543. X        (void)fd_hold();
  2544. X        return -1;
  2545. X    }
  2546. X
  2547. X    if (fd_hold() == -1)
  2548. X        return -1;
  2549. X
  2550. X#if    defined(LOAD_DEBUG)
  2551. X    fprintf(outfp, "procopen'd\n");
  2552. X#endif    /* defined(LOAD_DEBUG) */
  2553. X
  2554. X    /*
  2555. X     * Initialise the stack (arguments, environment and SP).
  2556. X     */
  2557. X    if (init_stack(argp, envp) == -1)
  2558. X        return -1;
  2559. X
  2560. X    return 0;
  2561. X}
  2562. X
  2563. Xstatic
  2564. Xint
  2565. Xrpushi(i)
  2566. Xint    i;
  2567. X{
  2568. X    unsigned long    sp;
  2569. X
  2570. X    if (quiet_procsget(R_SP, &sp) == -1)
  2571. X        return -1;
  2572. X
  2573. X    if (quiet_procmput(GLOBALdipc, sp, (char *)&i, sizeof(i)) == -1)
  2574. X        return -1;
  2575. X
  2576. X    sp += sizeof(i);
  2577. X
  2578. X    if (quiet_procsput(R_SP, sp) == -1)
  2579. X        return -1;
  2580. X
  2581. X    return 0;
  2582. X}
  2583. X
  2584. X#define    STRINGS_START    (USERSTACK - (EA_SIZE + NCARGS))
  2585. X
  2586. Xstatic
  2587. Xint
  2588. Xinit_stack(argv, envp)
  2589. Xchar    **argv;
  2590. Xchar    **envp;
  2591. X{
  2592. X    int        argc;
  2593. X    int        envc;
  2594. X    int        argi;
  2595. X    int        envi;
  2596. X    unsigned long    eventual_sp;
  2597. X    unsigned long    stringsp;
  2598. X
  2599. X    /*
  2600. X     * We make the stack look like this:
  2601. X
  2602. X    USERSTACK(0x7ffff000)    ->    |_______________| ___
  2603. X                    |               |  ^
  2604. X                    | Software FP   |  |
  2605. X                    | emulation save|  | EA_SIZE
  2606. X                    | area (32bytes)|  |
  2607. X                     |_______________| _v_
  2608. X                    |               |  ^
  2609. X                    | WASTED SPACE  |  |
  2610. X                    |               |  |
  2611. X                    | "e_strn\0"    |  |
  2612. X                    |    ***        |  |
  2613. X                    | "e_str0\0"    |  | NCARGS
  2614. X                    | "a_strn\0"    |  |
  2615. X                    |    ***        |  |
  2616. X                    | "a_str0\0"    |  |
  2617. X    STRINGS_START        ->    |_______________| _v_
  2618. X                    | 0             |
  2619. X                    | env[n]        |  ^
  2620. X                    | ...           |  |
  2621. X                    | env[0]        |  |
  2622. X                    | 0             |  |
  2623. X                    | argv[n]       |  |
  2624. X                    | ...           |  | 2*NCARGS
  2625. X                    | argv[0]       |  |
  2626. X    SP            ->    | argc          |  |
  2627. X                    |               |  |
  2628. X                    |               |  |
  2629. X                    |               |  |
  2630. X                    |               |  |
  2631. X                    |               |  |
  2632. X                     |_______________|  v
  2633. X     *
  2634. X     */
  2635. X
  2636. X    /*
  2637. X     * Count the argument strings.
  2638. X     */
  2639. X    argc = 0;
  2640. X    if (argv != (char **)0)
  2641. X    {
  2642. X        while (argv[argc] != (char *)0)
  2643. X            argc++;
  2644. X    }
  2645. X
  2646. X    /*
  2647. X     * Count the environment strings.
  2648. X     */
  2649. X    envc = 0;
  2650. X    if (envp != (char **)0)
  2651. X    {
  2652. X        while (envp[envc] != (char *)0)
  2653. X            envc++;
  2654. X    }
  2655. X
  2656. X    stringsp = STRINGS_START;
  2657. X    eventual_sp = STRINGS_START - (1 + envc + 1 + argc + 1) * NBPW;
  2658. X    eventual_sp &= ~0xF;    /* Quadword align the stack. */
  2659. X
  2660. X    if (quiet_procsput(R_SP, eventual_sp) == -1)
  2661. X        return -1;
  2662. X
  2663. X    /*
  2664. X     * Push argc.
  2665. X     */
  2666. X    if (rpushi(argc) == -1)
  2667. X        return -1;
  2668. X
  2669. X    /*
  2670. X     * Push the argument strings and their pointers.
  2671. X     */
  2672. X    for (argi = 0; argi < argc; argi++)
  2673. X    {
  2674. X        int    length;
  2675. X
  2676. X        if (rpushi(stringsp) == -1)
  2677. X            return -1;
  2678. X
  2679. X#if    defined(LOAD_DEBUG)
  2680. X        fprintf(outfp, "done an rpushi\n");
  2681. X#endif    /* defined(LOAD_DEBUG) */
  2682. X
  2683. X        length = strlen(argv[argi]) + 1;
  2684. X        if (quiet_procmput(GLOBALdipc, stringsp, argv[argi], length) == -1)
  2685. X            return -1;
  2686. X
  2687. X#if    defined(LOAD_DEBUG)
  2688. X        fprintf(outfp, "done a quiet_procmput\n");
  2689. X#endif    /* defined(LOAD_DEBUG) */
  2690. X
  2691. X        stringsp += length;
  2692. X    }
  2693. X
  2694. X    /*
  2695. X     * Push a null word.
  2696. X     */
  2697. X    if (rpushi(0) == -1)
  2698. X        return -1;
  2699. X
  2700. X    /*
  2701. X     * Push the environment strings and their pointers.
  2702. X     */
  2703. X    for (envi = 0; envi < envc; envi++)
  2704. X    {
  2705. X        int    length;
  2706. X
  2707. X        if (rpushi(stringsp) == -1)
  2708. X            return -1;
  2709. X
  2710. X        length = strlen(envp[envi]) + 1;
  2711. X        if (quiet_procmput(GLOBALdipc, stringsp, envp[envi], length) == -1)
  2712. X            return -1;
  2713. X
  2714. X        stringsp += length;
  2715. X    }
  2716. X
  2717. X    /*
  2718. X     * Push a null word.
  2719. X     */
  2720. X    if (rpushi(0) == -1)
  2721. X        return -1;
  2722. X
  2723. X    /*
  2724. X     * Reinitialise the stack pointer.
  2725. X     */
  2726. X    if (quiet_procsput(R_SP, eventual_sp) == -1)
  2727. X        return -1;
  2728. X
  2729. X    return 0;
  2730. X}
  2731. END_OF_FILE
  2732. if test 5439 -ne `wc -c <'load.c'`; then
  2733.     echo shar: \"'load.c'\" unpacked with wrong size!
  2734. fi
  2735. # end of 'load.c'
  2736. fi
  2737. if test -f 'makefile' -a "${1}" != "-c" ; then 
  2738.   echo shar: Will not clobber existing file \"'makefile'\"
  2739. else
  2740. echo shar: Extracting \"'makefile'\" \(6895 characters\)
  2741. sed "s/^X//" >'makefile' <<'END_OF_FILE'
  2742. X#
  2743. X# trash
  2744. X#
  2745. XTARGET    =trash
  2746. XUTARGET    =utrash
  2747. XSHELL    =/bin/sh
  2748. XRM    =/bin/rm -rf
  2749. XCHMOD    =/bin/chmod
  2750. X
  2751. XCC    =/bin/cc
  2752. XLD    =/bin/cc
  2753. XDFLAGS    =
  2754. XUDFLAGS    =$(DFLAGS)
  2755. XPFLAG    =
  2756. XCFLAGS    =-g3 -c
  2757. XUCFLAGS    =-j
  2758. XLDFLAGS    =$(PFLAG) -g3
  2759. X# Tried -Olimit at 700 but ran (slightly) slower...
  2760. XULDFLAGS    =$(PFLAG) -O3 -Olimit 600
  2761. XLIBS    =-lmld
  2762. XULIBS    =$(LIBS)
  2763. X#ULIBS    =-klmld
  2764. X
  2765. XOBJS    =\
  2766. X    bzero.o\
  2767. X    bsd43.o\
  2768. X    couldnot.o\
  2769. X    diblock.o\
  2770. X    dmult.o\
  2771. X    dmultu.o\
  2772. X    execvpath.o\
  2773. X    fd.o\
  2774. X    format.o\
  2775. X    generic.o\
  2776. X    getopt.o\
  2777. X    getprbyno.o\
  2778. X    go.o\
  2779. X    histogram.o\
  2780. X    history.o\
  2781. X    i_a.o\
  2782. X    i_b.o\
  2783. X    i_c.o\
  2784. X    i_d.o\
  2785. X    i_j.o\
  2786. X    i_l.o\
  2787. X    i_m.o\
  2788. X    i_n.o\
  2789. X    i_o.o\
  2790. X    i_s.o\
  2791. X    i_syscall.o\
  2792. X    i_u.o\
  2793. X    i_x.o\
  2794. X    load.o\
  2795. X    main.o\
  2796. X    myldopen.o\
  2797. X    myname.o\
  2798. X    optab.o\
  2799. X    posix.o\
  2800. X    process.o\
  2801. X    resource.o\
  2802. X    say.o\
  2803. X    sgttyb.o\
  2804. X    syms.o\
  2805. X    sysmess.o\
  2806. X    sysv.o\
  2807. X    usage.o\
  2808. X    vcouldnot.o\
  2809. X    warning.o\
  2810. X    wcache.o
  2811. X
  2812. XUOBJS    =\
  2813. X    bzero.u\
  2814. X    bsd43.u\
  2815. X    couldnot.u\
  2816. X    diblock.u\
  2817. X    execvpath.u\
  2818. X    fd.u\
  2819. X    format.u\
  2820. X    generic.u\
  2821. X    getopt.u\
  2822. X    getprbyno.u\
  2823. X    go.u\
  2824. X    histogram.u\
  2825. X    history.u\
  2826. X    i_a.u\
  2827. X    i_b.u\
  2828. X    i_c.u\
  2829. X    i_d.u\
  2830. X    i_j.u\
  2831. X    i_l.u\
  2832. X    i_m.u\
  2833. X    i_n.u\
  2834. X    i_o.u\
  2835. X    i_s.u\
  2836. X    i_syscall.u\
  2837. X    i_u.u\
  2838. X    i_x.u\
  2839. X    load.u\
  2840. X    main.u\
  2841. X    myldopen.u\
  2842. X    myname.u\
  2843. X    optab.u\
  2844. X    posix.u\
  2845. X    process.u\
  2846. X    resource.u\
  2847. X    say.u\
  2848. X    sgttyb.u\
  2849. X    syms.u\
  2850. X    sysmess.u\
  2851. X    sysv.u\
  2852. X    usage.u\
  2853. X    vcouldnot.u\
  2854. X    warning.u\
  2855. X    wcache.u
  2856. X
  2857. XUOBJSA    =\
  2858. X    dmult.o\
  2859. X    dmultu.o
  2860. X
  2861. X.c.u    :
  2862. X    $(CC) $(UDFLAGS) $(UCFLAGS) $*.c
  2863. X
  2864. X.c.o    :
  2865. X    $(CC) $(DFLAGS) $(CFLAGS) $*.c
  2866. X
  2867. X.u.o    :
  2868. X    $(CC) $(CFLAGS) $*.u
  2869. X
  2870. X$(TARGET):    $(OBJS) 
  2871. X    $(LD) $(LDFLAGS) -o $(TARGET) $(OBJS) $(LIBS)
  2872. X
  2873. X$(UTARGET):    $(UOBJS) $(UOBJSA)
  2874. X    -$(CC) $(ULDFLAGS) -o $(UTARGET) $(UOBJS) $(UOBJSA) $(ULIBS)
  2875. X    # ld complains and leaves the target unexecutable.
  2876. X    # Not sure what the complaints mean...
  2877. X    $(CHMOD) 755 $(UTARGET)
  2878. X
  2879. Xbzero.u : \
  2880. X    bzero.c
  2881. Xbsd43.u : \
  2882. X    bsd43.c \
  2883. X    register.h \
  2884. X    instrn.h \
  2885. X    symtab.h \
  2886. X    diblock.h \
  2887. X    process.h \
  2888. X    sysentry.h \
  2889. X    res.h \
  2890. X    nels.h \
  2891. X    flag.h \
  2892. X    generic.h
  2893. Xcouldnot.u : \
  2894. X    couldnot.c
  2895. Xdiblock.u : \
  2896. X    diblock.c \
  2897. X    entry.h \
  2898. X    diblock.h \
  2899. X    talloc.h \
  2900. X    nels.h
  2901. Xexecvpath.u : \
  2902. X    execvpath.c
  2903. Xfd.u : \
  2904. X    fd.c \
  2905. X    nels.h
  2906. Xformat.u : \
  2907. X    format.c
  2908. Xgeneric.u : \
  2909. X    generic.c \
  2910. X    register.h \
  2911. X    instrn.h \
  2912. X    symtab.h \
  2913. X    diblock.h \
  2914. X    process.h \
  2915. X    res.h
  2916. Xgetopt.u : \
  2917. X    getopt.c
  2918. Xgetprbyno.u : \
  2919. X    getprbyno.c
  2920. Xgo.u : \
  2921. X    go.c \
  2922. X    register.h \
  2923. X    instrn.h \
  2924. X    symtab.h \
  2925. X    diblock.h \
  2926. X    process.h \
  2927. X    nels.h
  2928. Xhistogram.u : \
  2929. X    histogram.c
  2930. Xhistory.u : \
  2931. X    history.c \
  2932. X    register.h \
  2933. X    instrn.h \
  2934. X    symtab.h \
  2935. X    diblock.h \
  2936. X    process.h
  2937. Xi_a.u : \
  2938. X    i_a.c \
  2939. X    register.h \
  2940. X    instrn.h \
  2941. X    symtab.h \
  2942. X    process.h \
  2943. X    diblock.h
  2944. Xi_b.u : \
  2945. X    i_b.c \
  2946. X    register.h \
  2947. X    instrn.h \
  2948. X    symtab.h \
  2949. X    process.h \
  2950. X    diblock.h
  2951. Xi_c.u : \
  2952. X    i_c.c \
  2953. X    register.h \
  2954. X    instrn.h \
  2955. X    symtab.h \
  2956. X    process.h \
  2957. X    diblock.h
  2958. Xi_d.u : \
  2959. X    i_d.c \
  2960. X    register.h \
  2961. X    instrn.h \
  2962. X    symtab.h \
  2963. X    process.h \
  2964. X    diblock.h
  2965. Xi_j.u : \
  2966. X    i_j.c \
  2967. X    register.h \
  2968. X    instrn.h \
  2969. X    symtab.h \
  2970. X    process.h \
  2971. X    diblock.h
  2972. Xi_l.u : \
  2973. X    i_l.c \
  2974. X    register.h \
  2975. X    instrn.h \
  2976. X    symtab.h \
  2977. X    process.h \
  2978. X    wcache.h \
  2979. X    diblock.h
  2980. Xi_m.u : \
  2981. X    i_m.c \
  2982. X    register.h \
  2983. X    instrn.h \
  2984. X    symtab.h \
  2985. X    process.h \
  2986. X    diblock.h
  2987. Xi_n.u : \
  2988. X    i_n.c \
  2989. X    register.h \
  2990. X    instrn.h \
  2991. X    symtab.h \
  2992. X    process.h \
  2993. X    diblock.h
  2994. Xi_o.u : \
  2995. X    i_o.c \
  2996. X    register.h \
  2997. X    instrn.h \
  2998. X    symtab.h \
  2999. X    process.h \
  3000. X    diblock.h
  3001. Xi_s.u : \
  3002. X    i_s.c \
  3003. X    register.h \
  3004. X    instrn.h \
  3005. X    symtab.h \
  3006. X    process.h \
  3007. X    wcache.h \
  3008. X    diblock.h
  3009. Xi_syscall.u : \
  3010. X    i_syscall.c \
  3011. X    register.h \
  3012. X    instrn.h \
  3013. X    symtab.h \
  3014. X    diblock.h \
  3015. X    process.h \
  3016. X    sysentry.h \
  3017. X    res.h \
  3018. X    nels.h
  3019. Xi_u.u : \
  3020. X    i_u.c
  3021. Xi_x.u : \
  3022. X    i_x.c \
  3023. X    register.h \
  3024. X    instrn.h \
  3025. X    symtab.h \
  3026. X    diblock.h \
  3027. X    process.h
  3028. Xload.u : \
  3029. X    load.c \
  3030. X    register.h \
  3031. X    instrn.h \
  3032. X    symtab.h \
  3033. X    diblock.h \
  3034. X    process.h
  3035. Xmain.u : \
  3036. X    main.c
  3037. Xmyldopen.u : \
  3038. X    myldopen.c
  3039. Xmyname.u : \
  3040. X    myname.c
  3041. Xoptab.u : \
  3042. X    optab.c \
  3043. X    instrn.h
  3044. Xposix.u : \
  3045. X    posix.c \
  3046. X    sysentry.h \
  3047. X    nels.h
  3048. Xprocess.u : \
  3049. X    process.c \
  3050. X    register.h \
  3051. X    instrn.h \
  3052. X    symtab.h \
  3053. X    diblock.h \
  3054. X    process.h \
  3055. X    wcache.h \
  3056. X    nels.h
  3057. Xresource.u : \
  3058. X    resource.c \
  3059. X    res.h
  3060. Xsay.u : \
  3061. X    say.c \
  3062. X    register.h
  3063. Xsgttyb.u : \
  3064. X    sgttyb.c
  3065. Xsyms.u : \
  3066. X    syms.c \
  3067. X    symtab.h
  3068. Xsysmess.u : \
  3069. X    sysmess.c
  3070. Xsysv.u : \
  3071. X    sysv.c \
  3072. X    register.h \
  3073. X    instrn.h \
  3074. X    symtab.h \
  3075. X    process.h \
  3076. X    sysentry.h \
  3077. X    nels.h \
  3078. X    res.h \
  3079. X    flag.h \
  3080. X    generic.h \
  3081. X    diblock.h
  3082. Xusage.u : \
  3083. X    usage.c
  3084. Xvcouldnot.u : \
  3085. X    vcouldnot.c \
  3086. X    register.h \
  3087. X    instrn.h \
  3088. X    symtab.h \
  3089. X    process.h \
  3090. X    diblock.h
  3091. Xwarning.u : \
  3092. X    warning.c
  3093. Xwcache.u : \
  3094. X    wcache.c \
  3095. X    nels.h
  3096. X
  3097. Xbzero.o : \
  3098. X    bzero.c
  3099. Xbsd43.o : \
  3100. X    bsd43.c \
  3101. X    register.h \
  3102. X    instrn.h \
  3103. X    symtab.h \
  3104. X    diblock.h \
  3105. X    process.h \
  3106. X    sysentry.h \
  3107. X    res.h \
  3108. X    nels.h \
  3109. X    flag.h \
  3110. X    generic.h
  3111. Xcouldnot.o : \
  3112. X    couldnot.c
  3113. Xdiblock.o : \
  3114. X    diblock.c \
  3115. X    entry.h \
  3116. X    diblock.h \
  3117. X    talloc.h \
  3118. X    nels.h
  3119. Xexecvpath.o : \
  3120. X    execvpath.c
  3121. Xfd.o : \
  3122. X    fd.c \
  3123. X    nels.h
  3124. Xformat.o : \
  3125. X    format.c
  3126. Xgeneric.o : \
  3127. X    generic.c \
  3128. X    register.h \
  3129. X    instrn.h \
  3130. X    symtab.h \
  3131. X    diblock.h \
  3132. X    process.h \
  3133. X    res.h
  3134. Xgetopt.o : \
  3135. X    getopt.c
  3136. Xgetprbyno.o : \
  3137. X    getprbyno.c
  3138. Xgo.o : \
  3139. X    go.c \
  3140. X    register.h \
  3141. X    instrn.h \
  3142. X    symtab.h \
  3143. X    process.h \
  3144. X    diblock.h \
  3145. X    nels.h
  3146. Xhistogram.o : \
  3147. X    histogram.c
  3148. Xhistory.o : \
  3149. X    history.c \
  3150. X    register.h \
  3151. X    instrn.h \
  3152. X    symtab.h \
  3153. X    diblock.h \
  3154. X    process.h
  3155. Xi_a.o : \
  3156. X    i_a.c \
  3157. X    register.h \
  3158. X    instrn.h \
  3159. X    symtab.h \
  3160. X    process.h \
  3161. X    diblock.h
  3162. Xi_b.o : \
  3163. X    i_b.c \
  3164. X    register.h \
  3165. X    instrn.h \
  3166. X    symtab.h \
  3167. X    process.h \
  3168. X    diblock.h
  3169. Xi_c.o : \
  3170. X    i_c.c \
  3171. X    register.h \
  3172. X    instrn.h \
  3173. X    symtab.h \
  3174. X    diblock.h \
  3175. X    process.h
  3176. Xi_d.o : \
  3177. X    i_d.c \
  3178. X    register.h \
  3179. X    instrn.h \
  3180. X    symtab.h \
  3181. X    diblock.h \
  3182. X    process.h
  3183. Xi_j.o : \
  3184. X    i_j.c \
  3185. X    register.h \
  3186. X    instrn.h \
  3187. X    symtab.h \
  3188. X    diblock.h \
  3189. X    process.h
  3190. Xi_l.o : \
  3191. X    i_l.c \
  3192. X    register.h \
  3193. X    instrn.h \
  3194. X    symtab.h \
  3195. X    diblock.h \
  3196. X    wcache.h \
  3197. X    process.h
  3198. Xi_m.o : \
  3199. X    i_m.c \
  3200. X    register.h \
  3201. X    instrn.h \
  3202. X    symtab.h \
  3203. X    diblock.h \
  3204. X    process.h
  3205. Xi_n.o : \
  3206. X    i_n.c \
  3207. X    register.h \
  3208. X    instrn.h \
  3209. X    symtab.h \
  3210. X    diblock.h \
  3211. X    process.h
  3212. Xi_o.o : \
  3213. X    i_o.c \
  3214. X    register.h \
  3215. X    instrn.h \
  3216. X    symtab.h \
  3217. X    diblock.h \
  3218. X    process.h
  3219. Xi_s.o : \
  3220. X    i_s.c \
  3221. X    register.h \
  3222. X    instrn.h \
  3223. X    symtab.h \
  3224. X    diblock.h \
  3225. X    wcache.h \
  3226. X    process.h
  3227. Xi_syscall.o : \
  3228. X    i_syscall.c \
  3229. X    register.h \
  3230. X    instrn.h \
  3231. X    symtab.h \
  3232. X    diblock.h \
  3233. X    process.h \
  3234. X    sysentry.h \
  3235. X    res.h \
  3236. X    nels.h
  3237. Xi_u.o : \
  3238. X    i_u.c
  3239. Xi_x.o : \
  3240. X    i_x.c \
  3241. X    register.h \
  3242. X    instrn.h \
  3243. X    symtab.h \
  3244. X    diblock.h \
  3245. X    process.h
  3246. Xload.o : \
  3247. X    load.c \
  3248. X    register.h \
  3249. X    instrn.h \
  3250. X    symtab.h \
  3251. X    diblock.h \
  3252. X    process.h
  3253. Xmain.o : \
  3254. X    main.c
  3255. Xmyldopen.o : \
  3256. X    myldopen.c
  3257. Xmyname.o : \
  3258. X    myname.c
  3259. Xoptab.o : \
  3260. X    optab.c \
  3261. X    instrn.h
  3262. Xposix.o : \
  3263. X    posix.c \
  3264. X    sysentry.h \
  3265. X    nels.h
  3266. Xprocess.o : \
  3267. X    process.c \
  3268. X    register.h \
  3269. X    instrn.h \
  3270. X    symtab.h \
  3271. X    diblock.h \
  3272. X    process.h \
  3273. X    wcache.h \
  3274. X    nels.h
  3275. Xresource.o : \
  3276. X    resource.c \
  3277. X    res.h
  3278. Xsay.o : \
  3279. X    say.c \
  3280. X    register.h
  3281. Xsgttyb.o : \
  3282. X    sgttyb.c
  3283. Xsyms.o : \
  3284. X    syms.c \
  3285. X    symtab.h
  3286. Xsysmess.o : \
  3287. X    sysmess.c
  3288. Xsysv.o : \
  3289. X    sysv.c \
  3290. X    register.h \
  3291. X    instrn.h \
  3292. X    symtab.h \
  3293. X    diblock.h \
  3294. X    process.h \
  3295. X    sysentry.h \
  3296. X    nels.h \
  3297. X    res.h \
  3298. X    flag.h \
  3299. X    generic.h
  3300. Xusage.o : \
  3301. X    usage.c
  3302. Xvcouldnot.o : \
  3303. X    vcouldnot.c \
  3304. X    register.h \
  3305. X    instrn.h \
  3306. X    symtab.h \
  3307. X    diblock.h \
  3308. X    process.h
  3309. Xwarning.o : \
  3310. X    warning.c
  3311. Xwcache.o : \
  3312. X    wcache.c \
  3313. X    nels.h
  3314. X
  3315. Xclobber:    clean
  3316. X    $(RM) $(TARGET) $(UTARGET)
  3317. X
  3318. Xclean:
  3319. X    $(RM) $(OBJS) $(UOBJS) [Mm]ade mon.out core tags
  3320. X
  3321. Xtags:
  3322. X    ctags *.[ch]
  3323. END_OF_FILE
  3324. if test 6895 -ne `wc -c <'makefile'`; then
  3325.     echo shar: \"'makefile'\" unpacked with wrong size!
  3326. fi
  3327. # end of 'makefile'
  3328. fi
  3329. if test -f 'trash.1' -a "${1}" != "-c" ; then 
  3330.   echo shar: Will not clobber existing file \"'trash.1'\"
  3331. else
  3332. echo shar: Extracting \"'trash.1'\" \(5996 characters\)
  3333. sed "s/^X//" >'trash.1' <<'END_OF_FILE'
  3334. X.TH TRASH 1
  3335. X.SH NAME
  3336. Xtrash \- trace system calls
  3337. X.SH SYNOPSIS
  3338. X.B trash
  3339. X[
  3340. X.I "-ABCFHILMNPRSTVW"
  3341. X]
  3342. X[
  3343. X.I "-a argc"
  3344. X]
  3345. X[
  3346. X.I "-d fd"
  3347. X]
  3348. X[
  3349. X.I "-f executable"
  3350. X]
  3351. X[
  3352. X.I "-h history_length"
  3353. X]
  3354. X[
  3355. X.I "-o outfile"
  3356. X]
  3357. X[
  3358. X.I "-v"
  3359. X]
  3360. X[
  3361. X.I command
  3362. X]
  3363. X.SH DESCRIPTION
  3364. X.IX trash "" "\fLtrash\fP \(em trace system calls"
  3365. X.I trash
  3366. Xsimulates the specified
  3367. X.I command
  3368. X(default:
  3369. X.IR a.out )
  3370. Xuntil it exits.
  3371. XA line of information is written to
  3372. Xa duplicate (as in
  3373. X.IR dup (2))
  3374. Xof the standard output immediately after each system call returns.
  3375. X.SH OPTIONS
  3376. X.TP
  3377. X.B \-A
  3378. Xall
  3379. X\- show all data in
  3380. X.IR read (2)
  3381. Xand
  3382. X.IR write (2)
  3383. Xarguments and results.
  3384. XNormally, only the first 32 bytes are shown.
  3385. XAlso show the \fCargv\fP and \fCenvp\fP vector arguments to
  3386. X.IR execve (2).
  3387. X.TP
  3388. X.B \-B
  3389. Xbook
  3390. X\- under the
  3391. X.I \-I
  3392. Xoption (see below) print the number of the page
  3393. Xin The Book ("MIPS RISC Architecture" by Gerry Kane)
  3394. Xwhere may be found a description of the simulated instruction.
  3395. X.TP
  3396. X.B \-C
  3397. XC-like
  3398. X\- show only assignments to registers and memory when used
  3399. Xwith the
  3400. X.I \-M
  3401. Xand
  3402. X.I \-R
  3403. Xoptions.
  3404. X.TP
  3405. X.B \-F
  3406. Xfollow
  3407. X\- follow calls to
  3408. X.IR execve (2)
  3409. Xby execution of another instance of
  3410. X.IR trash .
  3411. X.TP
  3412. X.B \-H
  3413. Xhistogram
  3414. X\-
  3415. X.I trash
  3416. Xwill count the number of references to the simulated
  3417. Xprogram's text space (in 4KB quanta) and will print this
  3418. Xinformation whenever it simulates an
  3419. X.IR execve (2),
  3420. Xan
  3421. X.IR exit (2)
  3422. Xor when the simulator exits.
  3423. X.TP
  3424. X.B \-I
  3425. Xinstruction
  3426. X\- print a line describing each MIPS instruction in a uniquely
  3427. Xinformative yet idiosyncratic format.
  3428. X.TP
  3429. X.B \-L
  3430. Xline
  3431. X\- do not make output line buffered.
  3432. X.TP
  3433. X.B \-M
  3434. Xmemory
  3435. X\- print a line describing each (simulated) memory access.
  3436. X.TP
  3437. X.B \-N
  3438. Xnumber
  3439. X\- show the number of (simulated) instructions executed since the
  3440. Xprevious system call and the total number of instructions
  3441. Xsimulated so far.
  3442. X.TP
  3443. X.B \-P
  3444. Xpredisplay
  3445. X\- print a line describing each system call before it is executed.
  3446. X.TP
  3447. X.B \-R
  3448. Xregister
  3449. X\- print a line describing each (simulated) register access.
  3450. X.TP
  3451. X.B \-S
  3452. Xsyscall
  3453. X\- do not print a line describing each system call after it is executed.
  3454. XIf this flag is not present then a line is printed describing each
  3455. Xsystem call after it is executed.
  3456. X.TP
  3457. X.B \-T
  3458. Xtime
  3459. X\- show the number of microseconds of system time that elapse
  3460. Xduring each system call.
  3461. X.TP
  3462. X.B \-V
  3463. Xverbose
  3464. X\- print even more output.
  3465. X.TP
  3466. X.B \-W
  3467. Xoverwrite
  3468. X\- do not truncate the output file before appending to it.
  3469. X.TP
  3470. X.B "\-a argc"
  3471. XThe first
  3472. X.B argc
  3473. Xtrailing arguments are to be taken as the
  3474. Xargument vector for the simulated process.
  3475. XThe next trailing argument is to be ignored.
  3476. XThe remaining trailing arguments are to be
  3477. Xtaken as the environment strings of the simulated process.
  3478. X(This feature is intended for
  3479. X.IR trash 's
  3480. Xown internal use under the
  3481. X.I \-F
  3482. Xoption.)
  3483. X.TP
  3484. X.B "\-d fd"
  3485. XWrite
  3486. X.IR trash 's
  3487. Xoutput to file descriptor
  3488. X.BR fd .
  3489. X(This feature is intended for
  3490. X.IR trash 's
  3491. Xown internal use under the
  3492. X.I \-F
  3493. Xoption.)
  3494. X.TP
  3495. X.B "\-f executable"
  3496. XAn unambiguous specification of the file that
  3497. Xshould be read to obtain the initial process image.
  3498. XWithout this option
  3499. X.I trash
  3500. Xwill search for the file indicated by the first
  3501. Xtrailing argument using the same algorithm as
  3502. X.IR execvp (2)
  3503. Xand
  3504. X.IR execlp (2).
  3505. X.TP
  3506. X.B "\-h history_length"
  3507. X.I trash
  3508. Xwill maintain a history of the last
  3509. X.I history_length
  3510. Xinstructions and will print them whenever it
  3511. Xsimulates an
  3512. X.IR execve (2),
  3513. Xan
  3514. X.IR exit (2)
  3515. Xor when the simulator exits.
  3516. X.TP
  3517. X.B "\-o outfile"
  3518. XWrite
  3519. X.IR trash 's
  3520. Xoutput to
  3521. X.BR outfile .
  3522. X.TP
  3523. X.B \-v
  3524. Xversion
  3525. X\- print the version string and then
  3526. X.IR exit (2).
  3527. X.SH CAVEATS
  3528. X.LP
  3529. XUnder the
  3530. X.I bsd43
  3531. Xuniverse,
  3532. Xmost system calls relating to signals are recognised but silently
  3533. Xignored.
  3534. X.LP
  3535. XUnder the
  3536. X.I bsd43
  3537. Xuniverse,
  3538. Xthe reception of signals by the simulated process is not
  3539. Ximplemented.
  3540. X.LP
  3541. XMost exceptions are ignored or handled crudely.
  3542. X.LP
  3543. XAttempts to access data at
  3544. Xinvalid (simulated) addresses or attempts to access data
  3545. Xat valid (simulated) addresses but in invalid ways are
  3546. Xdetected but are handled crudely.
  3547. X.LP
  3548. XUnder the
  3549. X.I bsd43
  3550. Xuniverse,
  3551. Xthe value returned by the
  3552. X.IR geteuid (2-BSD)
  3553. Xsystem call is actually the result of executing the
  3554. X.IR geteuid (2-SysV)
  3555. Xsystem call under the
  3556. X.I sysv
  3557. Xuniverse.
  3558. X.LP
  3559. XUnder the
  3560. X.I bsd43
  3561. Xuniverse, the value returned by the
  3562. X.IR pipe (2-BSD)
  3563. Xsystem call is actually the result of executing the
  3564. X.IR pipe (2-SysV)
  3565. Xsystem call under the
  3566. X.I sysv
  3567. Xuniverse.
  3568. X.LP
  3569. XThe passing of open file descriptors in
  3570. X.IR ioctl (2)
  3571. Xsystem calls (e.g. see I_FDINSERT in
  3572. X.IR streamio (7-SysV))
  3573. Xis not (yet) supported.
  3574. X.LP
  3575. XSome system calls are not yet implemented.
  3576. X.LP
  3577. XUnder the
  3578. X.I bsd43
  3579. Xuniverse,
  3580. X.IR vfork (2-BSD)
  3581. Xis (incorrectly) implemented as a normal
  3582. X.IR fork (2-BSD),
  3583. Xso programs that rely on the shared memory/state
  3584. Xproperties of the former will not simulate correctly.
  3585. X.LP
  3586. XSeveral MIPS instructions have not been implemented.
  3587. XThese are currently:
  3588. X.IR bgezal ,
  3589. X.IR bltzal ,
  3590. X.IR break ,
  3591. Xall
  3592. X.IR "coprocessor 0" ,
  3593. X.I "coprocessor 2"
  3594. Xand
  3595. X.I "coprocessor 3"
  3596. Xinstructions
  3597. Xand the following
  3598. X.I "coprocessor 1"
  3599. Xinstructions:
  3600. X.IR c.f ,
  3601. X.IR c.nge ,
  3602. X.IR c.ngl ,
  3603. X.IR c.ngle ,
  3604. X.IR c.ngt ,
  3605. X.IR c.seq ,
  3606. X.IR c.sf ,
  3607. X.I c.ueq
  3608. Xand
  3609. X.IR c.un .
  3610. X.LP
  3611. XThe simulator assumes that all the world is
  3612. X.IR big-endian .
  3613. X.LP
  3614. XUnder the
  3615. X.I sysv
  3616. Xuniverse,
  3617. X.IR profil (2-SysV),
  3618. Xand hence executable profiling, is ignored.
  3619. X.LP
  3620. XTo be simulated an executable file must be readable.
  3621. X.LP
  3622. XThe setuid and setgid mode bits of executables are ignored.
  3623. X.LP
  3624. XThe simulation of a process by
  3625. X.I trash
  3626. Xis much slower than the normal execution of that process.
  3627. X.LP
  3628. XThe
  3629. X.IR getdtablesize (2-BSD)
  3630. Xsystem call returns the same value as it would
  3631. Xunder normal execution, but the simulated
  3632. Xprocess will actually appear to run out
  3633. Xof file descriptors
  3634. X.RB ( EMFILE )
  3635. Xat a slightly lower number.
  3636. X.LP
  3637. XUnder the
  3638. X.I \-F
  3639. Xoption the
  3640. X.IR execve
  3641. Xsystem call is not correctly simulated if the
  3642. Xfirst (\fIpath\fP) argument is a shared library.
  3643. X.SH AUTHOR
  3644. XBruce Janson
  3645. X.br
  3646. Xbruce@cs.su.oz.au
  3647. X.SH SEE ALSO
  3648. X.IR trace (1)
  3649. Xunder SunOS4.1.
  3650. X.br
  3651. X.IR truss (1)
  3652. Xunder System V Release 4.0.
  3653. END_OF_FILE
  3654. if test 5996 -ne `wc -c <'trash.1'`; then
  3655.     echo shar: \"'trash.1'\" unpacked with wrong size!
  3656. fi
  3657. # end of 'trash.1'
  3658. fi
  3659. echo shar: End of archive 2 \(of 8\).
  3660. cp /dev/null ark2isdone
  3661. MISSING=""
  3662. for I in 1 2 3 4 5 6 7 8 ; do
  3663.     if test ! -f ark${I}isdone ; then
  3664.     MISSING="${MISSING} ${I}"
  3665.     fi
  3666. done
  3667. if test "${MISSING}" = "" ; then
  3668.     echo You have unpacked all 8 archives.
  3669.     rm -f ark[1-9]isdone
  3670. else
  3671.     echo You still need to unpack the following archives:
  3672.     echo "        " ${MISSING}
  3673. fi
  3674. ##  End of shell archive.
  3675. exit 0
  3676.